[SOLVED] Re: How to sort a file by pure ASCII order?

[SOLVED] Re: How to sort a file by pure ASCII order?

Omer Zak w1 at zak.co.il
Sun Sep 14 23:35:07 IDT 2014


Thanks, Jonathan, 'LC_ALL=C sort' did the trick.
Later I went back to 'man sort' and found there the warning to pay
attention to locale when running sort.  I missed the warning before...

On Sun, 2014-09-14 at 17:15 +0300, Jonathan Ben Avraham wrote:
> LC_ALL=C  ?
> 
> On Sun, 14 Sep 2014, Omer Zak wrote:
> 
> > Date: Sun, 14 Sep 2014 16:59:32 +0300
> > From: Omer Zak <w1 at zak.co.il>
> > To: linux-il <linux-il at cs.huji.ac.il>
> > Subject: How to sort a file by pure ASCII order?
> > 
> > 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?

-- 
Palestinians did not firmly and vocally and strongly denounce the Hannover attack (http://www.huffingtonpost.com/2010/06/24/german-youths-attack-jewi_n_623922.html) but rather supported the attack, even though it is yet another proof why Jews need their own country in which they can live safely.
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




More information about the Linux-il mailing list