bug-textutils
[Top][All Lists]
Advanced

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

Re: sort


From: Jim Meyering
Subject: Re: sort
Date: 18 Oct 2000 07:32:21 +0200
User-agent: Gnus/5.0807 (Gnus v5.8.7) Emacs/20.7

mike <address@hidden> writes:
| I am running Red Hat Linux 6.1.  The "sort" command is producing results
| I can't explain.  I used this command:
|
|           find / |xargs file -b |uniq |sort
|
| Here is a piece of the output:
|
|           ASCII C program text ASCII C++ program text ASCII C++ program
|      text, with CRLF, CR, LF line terminators ASCII C program text, with
|      CRLF, CR line terminators ASCII C program text, with CRLF, LF line
|      terminators ASCII C++ program text, with CRLF, LF line terminators
|      ASCII C program text, with CR, LF line terminators
|
| In ASCII, a space precedes a "+" precedes a "," precedes an alpha.  What have
| I missed?

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

BTW, in recent textutils test releases, sort --help output
includes this:

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



reply via email to

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