GNU bug report logs - #9334
sort bug

Previous Next

Package: coreutils;

Reported by: "ROGER GRAYDON CHRISTMAN" <dvl <at> psu.edu>

Date: Sat, 20 Aug 2011 20:28:01 UTC

Severity: normal

Done: Bob Proulx <bob <at> proulx.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eric Blake <eblake <at> redhat.com>
To: ROGER GRAYDON CHRISTMAN <dvl <at> psu.edu>
Cc: 9334 <at> debbugs.gnu.org, Bob Proulx <bob <at> proulx.com>
Subject: bug#9334: sort bug
Date: Mon, 22 Aug 2011 08:44:57 -0600
On 08/22/2011 07:47 AM, ROGER GRAYDON CHRISTMAN wrote:
> Thanks.  I guess I misinterpreted "uses a default key of the entire line"
> as "uses the entire line as keys by default", in which case if the first column
> was equal, it would compare the second, then the third, etc.
>
> I guess I don't know what "default key of the entire line" means with respect
> to -n,
> since it apparently didn't treat "1    12" as "112" and "1   4" as 14.
> I'm curious to find out what this phrase means in this context.

'sort --debug' is your friend.  In the C locale, global -n means 'parse 
as much of the prefix of the line as can be treated as a number as the 
primary key, then treat the entire line as the secondary key'.

$ printf ' 1 12\n 1  4\n 5 16\n 9 20\n' | LC_ALL=C sort --debug -n
sort: using simple byte comparison
 1  4
 _
_____
 1 12
 _
_____
 5 16
 _
_____
 9 20
 _
_____


-- 
Eric Blake   eblake <at> redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org




This bug report was last modified 13 years and 275 days ago.

Previous Next


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