[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Incorrect lexographical sort in sort (coreutils) 5.2.1

From: Bob Proulx
Subject: Re: Incorrect lexographical sort in sort (coreutils) 5.2.1
Date: Thu, 27 Oct 2005 22:53:13 -0600
User-agent: Mutt/1.5.9i

Murray Stokely wrote:
> The current version of GNU sort on my Linux box incorrectly
> sorts the following simple file, while an older version of GNU
> sort on MacOS X 10.4 works fine.

Thanks for the report.  It is most appreciated.  However it matches a
very common problem signature which is not usually a bug in sort.  (Or
ls or grep or others either.)  It matches one of the FAQs, which by
definition are asked frequently!  :-)

> $ sort --version
> sort (coreutils) 5.2.1

Good.  However a newer release are available.  And yet another is
being prepared for the near future so stay tuned.

  ftp://ftp.gnu.org/gnu/coreutils/coreutils-5.92.tar.gz   (7.2MB)
  ftp://ftp.gnu.org/gnu/coreutils/coreutils-5.92.tar.bz2   (4.6MB)

>            $ sort scrambled
> version0/data/r=2/1/42 12.3
> version0/data/r=2/1/45 3.2
> version0/data/r=2 146839.1
> version0/data/r=2/1/51 10.9
> version0/data/r=2/1/52 6.6
> version0/data/r=2/1/54 7.5

It sorts according to your 'locale'.  If your locale specifies a
dictionary sort order then case is folded and punctuation is
ignored. That matches your example.

What is the output of the locale program on your system?  Some locales
are dictionary sort order where case is folded and punctuation is


This is an FAQ.  Here is a semi-standard reply:

Try this and then try your test again.

  unset LANG
  export LC_ALL=POSIX

Please read this faq, look for "Sort does not sort" for the entry in


See your system and other standards documentation for how it reacts in
the presence of locales.


Hope that helps,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]