Bug 127694 - sort -kx -kybn does not sort numerically on key y
sort -kx -kybn does not sort numerically on key y
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: coreutils (Show other bugs)
2
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Tim Waugh
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-07-12 13:25 EDT by Graham King
Modified: 2007-11-30 17:10 EST (History)
0 users

See Also:
Fixed In Version: 5.2.1-18
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-07-13 09:44:31 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Graham King 2004-07-12 13:25:11 EDT
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 15:37:38 EDT
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 09:44:31 EDT
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.