Bug 127694 - sort -kx -kybn does not sort numerically on key y
Summary: sort -kx -kybn does not sort numerically on key y
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: coreutils
Version: 2
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Tim Waugh
QA Contact:
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-07-12 17:25 UTC by Graham King
Modified: 2007-11-30 22:10 UTC (History)
0 users

(edit)
Clone Of:
(edit)
Last Closed: 2004-07-13 13:44:31 UTC


Attachments (Terms of Use)

Description Graham King 2004-07-12 17:25:11 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040510

Description of problem:
When sorting on two keys, the "n" (numeric) flag on the second key is
not honoured.

Version-Release number of selected component (if applicable):
coreutils-5.2.1-7

How reproducible:
Always

Steps to Reproduce:
1.data="b      0
b     88
a      0
a  17454
a   2338"

2. echo "$data" | sort -k1,1 -k2bn,2
3.
    

Actual Results:  
a      0
a  17454
a   2338
b      0
b     88


Expected Results:  
a      0
a   2338
a  17454
b      0
b     88

Additional info:

I have tried various other, equivalent, syntaxes for specifying the
keys, and various input data.  The bug is consistently reproducible.

Note that 
echo "$data" | sort -k2bn,2
does sort numerically, as expected.

Comment 1 Graham King 2004-07-12 19:37:38 UTC
The following work-round works:

echo "$data" | LC_ALL=C sort -k4,4  -k5bn,5

Thanks to http://www.tinyvital.com/techblog/archives/000332.html

(for info, 
env | grep LC
returned nothing in my environment.)

Comment 2 Tim Waugh 2004-07-13 13:44:31 UTC
This was a bug in the i18n patch.  Fixed in 5.2.1-18.  Thanks for the
report.


Note You need to log in before you can comment on or make changes to this bug.