bug-coreutils
[Top][All Lists]
Advanced

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

Re: sort not sorting right?


From: Bob Proulx
Subject: Re: sort not sorting right?
Date: Fri, 25 Feb 2005 21:17:09 -0700
User-agent: Mutt/1.5.6+20040907i

Bertram Franz wrote:
> I have an issue with sort. A file

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 either.)

> A:B
> A:F
> AC:B
> 
> is, in my eyes already sorted correctly. When running it through sort 
> (no options), it comes back with
> 
> A:B
> AC:B
> A:F
> 
> Somehow it acts as if -d was specified, but it wasn't. I experimented 
> with the -t : option, no success.

It sorts according to your 'locale'.  What is the output of the locale
program on your system?  Some locales are dictionary sort order where
case is folded and punctuation is ignored.

  locale

> How can I sort a file without ignoring colons, or tabs, or spaces?
> 
> I tried on different machines with
> textutils-2.0.14-2 (RHES 2.1)
> coreutils-5.2.1-31 (Fedora Core 3)
> coreutils-5.2.1-32 (SuSE 9.2)

The systems you mention above are probably setting LANG without your
knowledge by default.  (I wish they would not do that.)

> On an HP-UX machine I get the desired result ...

HP-UX does not set LANG by default.  I am sure your local there is C
or POSIX giving you a standard environment there.  Run 'locale' to
check.

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
question.

  http://www.gnu.org/software/coreutils/faq/

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

  http://www.unix-systems.org/single_unix_specification_v2/xcu/sort.html

Hope that helps,
Bob




reply via email to

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