GNU bug report logs - #8394
unexpected behaviour of "sort -n"

Previous Next

Package: coreutils;

Reported by: Toralf Förster <toralf.foerster <at> gmx.de>

Date: Thu, 31 Mar 2011 16:48:08 UTC

Severity: normal

Done: Jim Meyering <jim <at> meyering.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 8394 in the body.
You can then email your comments to 8394 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#8394; Package coreutils. (Thu, 31 Mar 2011 16:48:08 GMT) Full text and rfc822 format available.

Acknowledgement sent to Toralf Förster <toralf.foerster <at> gmx.de>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Thu, 31 Mar 2011 16:48:08 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Toralf Förster <toralf.foerster <at> gmx.de>
To: bug-coreutils <at> gnu.org
Subject: unexpected behaviour of "sort -n"
Date: Thu, 31 Mar 2011 13:17:07 +0200
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




Reply sent to Jim Meyering <jim <at> meyering.net>:
You have taken responsibility. (Thu, 31 Mar 2011 17:19:02 GMT) Full text and rfc822 format available.

Notification sent to Toralf Förster <toralf.foerster <at> gmx.de>:
bug acknowledged by developer. (Thu, 31 Mar 2011 17:19:02 GMT) Full text and rfc822 format available.

Message #10 received at 8394-done <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Toralf Förster <toralf.foerster <at> gmx.de>
Cc: 8394-done <at> debbugs.gnu.org
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 coreutils <at> gnu.org, since there they don't automatically
cause creation of a "bug report" that we then have to
classify/close.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 29 Apr 2011 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 14 years and 61 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.