[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: different behavior of sort
From: |
Sheila Yao |
Subject: |
RE: different behavior of sort |
Date: |
Tue, 19 Jan 2010 10:58:14 -0500 |
Eric:
Very interesting. However, it doesn't seem to work, after I followed the
instructions of
http://www.gnu.org/software/coreutils/faq/coreutils-faq.html#Sort-does-not-sort-in-normal-order_0021.
At the host that sort doesn't work, where LC_ALL is null, I ran:
export LC_ALL=POSIX
env |grep LC_ALL
LC_ALL=POSIX
But sort still doesn't work:
sort -n -k2.1,2.4 /tmp/sort.out
/dev/emcpowera 47G 39G 7.8G 84% /DB1/DW/data9
/dev/emcpowerb 47G 43G 4.2G 91% /DB1/DW/data10
/dev/emcpowerc 46G 181M 46G 1% /DB1/DW/dwtmp16
/dev/emcpowerh 70G 30G 40G 43% /DB1/DW/data6
/dev/emcpoweri 70G 68G 2.2G 97% /DB1/DW/data7
/dev/emcpowerj 70G 68G 2.1G 97% /DB1/DW/data8
/dev/emcpowerl 540G 439G 102G 82% /DB1/DW/data3
/dev/emcpowerm 540G 420G 121G 78% /DB1/DW/data5
/dev/emcpowern 23G 14G 9.4G 59% /DB1/DW/data4
/dev/emcpowero 540G 509G 32G 95% /DB1/DW/data2
/dev/emcpoweru 600G 407G 194G 68% /DB1/DW/data1
/dev/emcpowerw 183G 29G 154G 16% /DB1/DW/LOGARCH
/dev/emcpowery 92G 188M 92G 1% /DB1/DW/LOGACT
===================================================================
At the other host where sort works, I ran:
export LC_ALL=POSIX
env |grep LC_ALL
LC_ALL=POSIX
And sort stopped working:
sort -n -k2.1,2.4 /tmp/sort.out
/dev/emcpowera 47G 39G 7.8G 84% /DB1/DW/data9
/dev/emcpowerb 47G 43G 4.2G 91% /DB1/DW/data10
/dev/emcpowerc 46G 181M 46G 1% /DB1/DW/dwtmp16
/dev/emcpowerh 70G 30G 40G 43% /DB1/DW/data6
/dev/emcpoweri 70G 68G 2.2G 97% /DB1/DW/data7
/dev/emcpowerj 70G 68G 2.1G 97% /DB1/DW/data8
/dev/emcpowerl 540G 439G 102G 82% /DB1/DW/data3
/dev/emcpowerm 540G 420G 121G 78% /DB1/DW/data5
/dev/emcpowern 23G 14G 9.4G 59% /DB1/DW/data4
/dev/emcpowero 540G 509G 32G 95% /DB1/DW/data2
/dev/emcpoweru 600G 407G 194G 68% /DB1/DW/data1
/dev/emcpowerw 183G 29G 154G 16% /DB1/DW/LOGARCH
/dev/emcpowery 92G 188M 92G 1% /DB1/DW/LOGACT
After I set it back to null, which was null originally, sort worked:
export LC_ALL=
sort -n -k2.1,2.4 /tmp/sort.out
/dev/emcpowern 23G 14G 9.4G 59% /DB1/DW/data4
/dev/emcpowerc 46G 181M 46G 1% /DB1/DW/dwtmp16
/dev/emcpowera 47G 39G 7.8G 84% /DB1/DW/data9
/dev/emcpowerb 47G 43G 4.2G 91% /DB1/DW/data10
/dev/emcpowerh 70G 30G 40G 43% /DB1/DW/data6
/dev/emcpoweri 70G 68G 2.2G 97% /DB1/DW/data7
/dev/emcpowerj 70G 68G 2.1G 97% /DB1/DW/data8
/dev/emcpowery 92G 188M 92G 1% /DB1/DW/LOGACT
/dev/emcpowerw 183G 29G 154G 16% /DB1/DW/LOGARCH
/dev/emcpowerl 540G 439G 102G 82% /DB1/DW/data3
/dev/emcpowerm 540G 420G 121G 78% /DB1/DW/data5
/dev/emcpowero 540G 509G 32G 95% /DB1/DW/data2
/dev/emcpoweru 600G 407G 194G 68% /DB1/DW/data1
At both hosts, it is LANG=en_US.UTF-8.
I've checked several hosts. When sort is 5.2.1, it works. When sort is 5.97, it
doesn't work. All hosts have LANG=en_US.UTF-8.
Thanks.
Have a nice day,
Sheila Yao
-----Original Message-----
From: Eric Blake [mailto:address@hidden
Sent: Monday, January 18, 2010 9:54 PM
To: Sheila Yao
Cc: address@hidden
Subject: Re: different behavior of sort
According to Sheila Yao on 1/18/2010 12:32 PM:
> At one box, I've sort version 5.2.1 and sort works correctly. At another box
> with sort 5.97, it doesn't work correctly.
Both of those are quite old. The latest stable version is 8.4.
> It works correctly for this output:
It probably works correctly for both outputs, with the difference boiling down
to a difference in your input - namely your locale environment variables. This
is a FAQ:
http://www.gnu.org/software/coreutils/faq/coreutils-faq.html#Sort-does-not-sort-in-normal-order_0021
--
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden