bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#8394: unexpected behaviour of "sort -n"


From: Jim Meyering
Subject: bug#8394: unexpected behaviour of "sort -n"
Date: Thu, 31 Mar 2011 19:17:57 +0200

tags 8394 + notabug
thanks

Toralf Förster wrote:
> I'm wondering about the output b/c Im missing 2 strings :
>
> $> echo "X y z 1 2 3" | xargs -n 1 | sort -n -u
> X
> 1
> 2
> 3

That's because you've specified -n (--numeric-sort)
yet gave it non-numeric data.  Each non-numeric
value is mapped to the same "invalid" quantity, and
since three values are "invalid" and you also used -u,
you see only one of them in the output.

For the record, you can reproduce it more simply like this:

    $ printf '%s\n' X y z 1 2 3|sort -n -u
    X
    1
    2
    3

Remove either the -n or the -u and you'll see all values.

I've marked the issue your message created as "closed".

For next time, we prefer that questions be addressed
to address@hidden, since there they don't automatically
cause creation of a "bug report" that we then have to
classify/close.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]