[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: question-problem with sort
From: |
Bob Proulx |
Subject: |
Re: question-problem with sort |
Date: |
Thu, 10 Mar 2005 10:01:56 -0700 |
User-agent: |
Mutt/1.5.6+20040907i |
Paul Riggs wrote:
> Is the "sort" command supposed to be case-sensitive? The info
> pages imply that it is, but it does not seem to be in various tests I've
> run on different versions of it including the current version (from
> coreutils-5.2.1).
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 in 'ls' either.
> For example:
>
> >ls
> a B c
> >ls |sort
> a
> B
> c
> >ls |sort -f
> a
> B
> c
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
The systems you mention above are probably setting LANG to a
dictionary sort order locale without your knowledge. (I wish they
would not do that.)
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.opengroup.org/onlinepubs/007908799/xcu/sort.html
http://www.opengroup.org/onlinepubs/007908799/xbd/locale.html
Hope that helps,
Bob