$ cat a
20
1
3
8
$ export LC_ALL=POSIX
$ echo $LC_ALL
POSIX
$ sort -n a
8
3
1
20

http://www.mail-archive.com/bug-textutils%40gnu.org/msg00106.html


Title: Re: bug in 'sort' with '-n' or 'n' options?
Mail Archive

bug-textutils

<-- Chronological --> Find  <-- Thread -->

Re: bug in 'sort' with '-n' or 'n' options?


  • From: Jim Meyering
  • Subject: Re: bug in 'sort' with '-n' or 'n' options?
  • Date: Tue, 06 Jun 2000 03:13:16 -0700

"craig martin" <[EMAIL PROTECTED]> writes:
| I wrote yesterday that "the sort utility program (written by Mike Haertel) that
| came with my Red Hat LInux 6.2 (obtained about April 2000) and that is part of
| the GNU textutils 2.0a (December 1999) seems to have a fundamental flaw".  I
| have found that the problem is more basic than I realised. 

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 LC_ALL to en_US).

You should set LC_ALL to POSIX

  # If you use bash or some other Bourne-based shell,
  export LC_ALL=POSIX

  # If you use a C-shell,
  setenv LC_ALL POSIX

and then sort will work the way you expect.



<-- Chronological --> <-- Thread -->

Reply via email to

Reply via email to