[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sort utility
From: |
Bob Proulx |
Subject: |
Re: sort utility |
Date: |
Sun, 26 Jun 2005 09:21:14 -0600 |
User-agent: |
Mutt/1.5.9i |
John J. Herda wrote:
> I am trying to get an ASCII sort and am having great
> troubles and frustration. It appears that there is no
> switch to force an ASCII sort, only for other kinds of
> sorts. It appears that environment variables: LC_ALL,
> LC_COLLATE, LC_CTYPE, and LANG all influence how sort
> works and that one interferes with another. Before I
> rebooted setting LC_COLLATE=C seemed to make it work
> right, I think. Anyway, I had it working right then I
> rebooted and now it does not work right. I do not
> know why, do you? Could you, please, help me?
The LC_ALL variable overrides all other locale setting variables.
Setting it to C should definitly cause sort to sort in a standard
order. However as you note setting LC_COLLATE should also set the
sorting order.
Use the 'locale' command to see what variables are affecting your
environment. I think you have probably set LC_ALL and missed it when
double checking.
locale
Unset LC_ALL, set LC_COLLATE to C, then check if sort is behaving as
you expect.
unset LC_ALL
export LC_COLLATE=C
As far as rebooting is concerned, intrinsically it has no effect on
sort. Only the environment and options to sort affect it. I think
your rebooting is simply confusing you. If you are rebooting to fix
sort then I think you misunderstand. At the worst if you have changed
your login files (e.g. ~/.bash_profile) you might want to log out of
your login and log back in again to get a new environment as specified
by your login files. Logging out in the GNU/UNIX world is about the
same as rebooting.
You seem to be aware of the issues but I will reference the FAQ anyway.
http://www.gnu.org/software/coreutils/faq/
Look for "Sort does not sort in normal order!"
Bob