--- Begin Message ---
Subject: |
unexpected behaviour of "sort -n" |
Date: |
Thu, 31 Mar 2011 13:17:07 +0200 |
User-agent: |
KMail/1.13.6 (Linux/2.6.38.2; KDE/4.6.1; i686; ; ) |
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
--
MfG/Sincerely
Toralf Förster
pgp finger print: 7B1A 07F4 EC82 0F90 D4C2 8936 872A E508 7DB6 9DA3
--- End Message ---
--- Begin Message ---
Subject: |
Re: 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.
--- End Message ---