Hello,

the following behaviour of "sort -nu" needs not necessarily be considered a bug:

$ echo ",2,0,1,-2,3,-4" | tr "," "\n" | sort -nu
-4
-2

1
2
3

This means: An empty line (and likewise: a line not starting with a number) is interpreted as having
the key "0". Since it occurs before the line starting with "0" here, the latter is missing in the output,
which contains the empty line instead. So one may think that the key "0" does not appear in the
input, even more so if there are no keys with negative numbers.


Possible solutions: Interpret empty lines (and lines not starting with a number) as having the key
plus or minus infinity, or leave it as it is, mentioning the chosen convention in the documentation.
Thank you!


With kind regards
Ulrich Hermisson




_______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to