Omer Zak
2014-09-14 13:59:32 UTC
I encountered a counterintuitive behavior of 'sort' in modern Linux
releases.
I checked the sorting behavior of sort, as installed in Debian Jessie
and Ubuntu 14.04 LTS.
Turns out that the default behavior of sort (with locale=en_US.UTF-8) is
not to sort by ASCII order, but as if letters and digits are more
important to sort order than punctuation marks.
Attached please find a sort-test.txt file and the output of
sort < sort-test.txt (as the file actual.txt).
To show how would the output look like using pure ASCII sort, I sorted
sort-test.txt using python-sort.py (attached).
and got the result reproduced in correct.txt (attached).
The problem is then what options would get GNU sort to sort like
python-sort.py?
Can anyone shed a light on the matter?
--- Omer
releases.
I checked the sorting behavior of sort, as installed in Debian Jessie
and Ubuntu 14.04 LTS.
Turns out that the default behavior of sort (with locale=en_US.UTF-8) is
not to sort by ASCII order, but as if letters and digits are more
important to sort order than punctuation marks.
Attached please find a sort-test.txt file and the output of
sort < sort-test.txt (as the file actual.txt).
To show how would the output look like using pure ASCII sort, I sorted
sort-test.txt using python-sort.py (attached).
and got the result reproduced in correct.txt (attached).
The problem is then what options would get GNU sort to sort like
python-sort.py?
Can anyone shed a light on the matter?
--- Omer
--
No actual electrons, animals or children were harmed by writing this
E-mail message.
My own blog is at http://www.zak.co.il/tddpirate/
My opinions, as expressed in this E-mail message, are mine alone.
They do not represent the official policy of any organization with which
I may be affiliated in any way.
WARNING TO SPAMMERS: at http://www.zak.co.il/spamwarning.html
No actual electrons, animals or children were harmed by writing this
E-mail message.
My own blog is at http://www.zak.co.il/tddpirate/
My opinions, as expressed in this E-mail message, are mine alone.
They do not represent the official policy of any organization with which
I may be affiliated in any way.
WARNING TO SPAMMERS: at http://www.zak.co.il/spamwarning.html