[Top][All Lists]

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

bug#9334: sort bug

From: Eric Blake
Subject: bug#9334: sort bug
Date: Mon, 22 Aug 2011 08:44:57 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20110621 Fedora/3.1.11-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.11

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   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

reply via email to

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