Post #2493652
2026-05-13 19:59 UTC
oof. lost 20 minutes of work because of this
today i learned: sort -u is not exactly sort | uniq. if you do sort -n -u, the uniq applies only to the sort key, which with -n will be only the numeric value.
so with this data:
10 a
1 b
10 c
1 b
these all behave as expected
$ sort data
10 a
10 c
1 b
1 b
$ sort -n data
1 b
1 b
10 a
10 c
$ sort -u data
10 a
10 c
1 b
but unique+numeric loses 10 c too
$ sort -nu data
1 b
10 a
Replies (0)
No replies.