[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Sort doesn't!
Re: Sort doesn't!
Fri, 9 Mar 2001 18:59:25 -0700
> I frequently try to use the sort function, but find it often does not
> perform an accurate sort, especially a numerical sort.
> I am using version 2.0a under RedHat Linux 6.2.
> Several shell scripts that worked fine under 5.0 now fail to work
> successfully. Just pipe a list of a couple of hundred integers to "sort
> -n" and you will find that you don't get an accurately sorted output. It
> is mostly correct but will have numerous figures in the wrong place.
Thank you for your report. Jim has previously answered these reports
with the following mail. Note that some vendors set those language
variables for you without you being aware of them.
Jim Meyering writes:
You are using the version of sort that comes with textutils-2.0
or newer and have reported a problem whereby it is sorting in
some non-ASCII order.
That is due not to a bug in sort, but to the fact that you have
set environment variables that direct sort to use improper locale-
specific tables (you or your vendor have probably set environment
variables like LANG, LC_ALL, or LANGUAGE to en_US).
Unset them, and then set LC_ALL to POSIX
# If you use bash or some other Bourne-based shell,
# If you use a C-shell,
setenv LC_ALL POSIX
and sort will then work the way you expect.
BTW, in recent textutils test releases, sort --help output
*** WARNING ***
This version of sort honors the locale settings in your environment.
For example, if you set one of the LANG or LC_ALL environment variables
to `en_US', then sort will work very differently than most people expect.
If that's not what you want, then set LC_ALL to POSIX in your environment.
- Sort doesn't!, postmaster, 2001/03/09
- Re: Sort doesn't!,
Bob Proulx <=