#893524 coreutils: unexpected behavior for sort -n -u

Package:
coreutils
Source:
coreutils
Description:
GNU core utilities
Submitter:
drcnjio908
Date:
2025-10-20 17:39:02 UTC
Severity:
normal
Tags:
#893524#5
Date:
2018-03-19 16:50:45 UTC
From:
To:
Dear Maintainer,

When using -n -u, the "2b-bar" line gets dropped very unexpectedly. I don't
think this should be default behavior, at least I am now very wary and will
avoid sort -n -u whenever possible:

echo -e '1a-foo\n1b-bar\n2' | sort -n -u
   1a-foo
   2

but with uniq it works like expected:

echo -e '1a-foo\n1b-bar\n2' | sort -n | uniq
    1a-foo
    1b-bar
    2