Newsgroups: gmane.linux.debian.user Date: Thu, 14 Sep 2006 13:01:25 -0400
I just noticed on a brand new install of testing that ls has begun to sort alphabetically, but mixes uppercase and lowercase together i.e. 'Pearl' comes before 'pearl' but after 'otter'.
otter Pearl pearl
A stable Debian version I maintain behaves the good old-fashioned way:
Pearl otter pearl
Is this some utf-8 mutation?
Eric d'Alibut
> > Is this some utf-8 mutation? > > Yup. If you want the old behavior, use this: > > export LC_COLLATE=C
Bingo. Thank you sir!
Eric d'Alibut
Newsgroups: gmane.linux.debian.user Date: Tue, 17 Oct 2006 04:23:44 +0200
> I think there're unicode.
This is not directly related to Unicode (this also happens with ISO8859-1), but to a language.
> export LC_COLLATE=C
and this will also fix the hyphen-minus problem:
vin:~> printf '%s\n' 1-2 1-3 12 13 | LC_COLLATE=en_US.UTF-8 sort 12 1-2 13 1-3 vin:~> printf '%s\n' 1-2 1-3 12 13 | LC_COLLATE=en_US.ISO8859-1 sort 12 1-2 13 1-3 vin:~> printf '%s\n' 1-2 1-3 12 13 | LC_COLLATE=C sort 1-2 1-3 12 13
Alternatively, one can use LC_COLLATE=POSIX.
Vincent Lefevre
Newsgroups: gmane.linux.debian.user Date: Tue, 17 Oct 2006 17:31:00 -0400
> >> >I want that behavior. How can I do that, instead of the traditional order? > >> > >> I'm using testing, and it's doing this for me by default. > > > > I'm also using testing, and mine also does this by default.... > > Mine (Debian testing) isn't: > > $ ls -1 > Pearl > otter > pearl > > Hence I want to know how to do it.
The environment variables LANG and LC_COLLATE control sort order and regex pattern matching expansion.
See files: /etc/environment and possibly /etc/profile (if edited…) LC_COLLATE is set via LANG (or LANGUAGE) unless overridden via the shell. Use the command "locale" to see the current values.
I have always used LANG="C" or "POSIX" which pays attention to the case:
Readme SRC bin palm sco
If you want the other rules use LANG=en_US (or just for the sort order, LC_COLLATE="en_US") to get:
bin palm Readme sco SRC
Larry Irwin