LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-24-2007, 08:16 AM   #1
mcwasi
LQ Newbie
 
Registered: Oct 2002
Location: Vienna(AT)/Potsdam(DE)
Distribution: Debian/Ubuntu
Posts: 8

Rep: Reputation: 0
ls sorting problem: lower and upper case folded?


Hi there,
I recently upgraded from Debian edge to Ubuntu 7.10.
Now, I found that ls folds upper and lower case letters when sorting alphabetically.
So far, I always had all the upper case letters coming first, which I find very useful. Now they are folded.
What can I do?
There is no option within ls to change that.
The command sort has a -f option to fold upper and lower case letters, but no +f option to unfold them.
I'm sure there must be an environment or shell variable to fix this, but I just can't find it.
Can anyone help me with this one?
Cheers!
McWasi
 
Old 10-24-2007, 08:24 AM   #2
Nick_Battle
Member
 
Registered: Dec 2006
Location: Bracknell, UK
Distribution: SUSE 13.1
Posts: 159

Rep: Reputation: 33
It might be due to the collating sequence for the locale that you're under. I see you're in Austria/Germany. Does it make a difference if you switch locale to (say) en_US or en_UK?
 
Old 10-24-2007, 08:31 AM   #3
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
Could this have something to do with it?

http://www.certforums.co.uk/forums/a...hp?t-7857.html

Seems like my 'ls' is giving case sensitive answers..

Last edited by b0uncer; 10-24-2007 at 08:32 AM. Reason: typos typos typos
 
Old 10-24-2007, 09:30 AM   #4
mcwasi
LQ Newbie
 
Registered: Oct 2002
Location: Vienna(AT)/Potsdam(DE)
Distribution: Debian/Ubuntu
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by b0uncer View Post
Could this have something to do with it?

http://www.certforums.co.uk/forums/a...hp?t-7857.html
Hi b0uncer: Yes, that did it!
When setting the environmen variable LC_COLLATE to C, then ls
sorts in the familiar way again: firts upper case letters, then lower case.
Thanks!

Nick: My system language is (and always was) en_US. So it doesn't seem to be related to the language.

I checked my former debian system: there was no variable LC_COLLATE set, nevertheless it showed upper case first. Strange.

Never mind, it works now. Thanks!
 
Old 10-24-2007, 09:52 AM   #5
Nick_Battle
Member
 
Registered: Dec 2006
Location: Bracknell, UK
Distribution: SUSE 13.1
Posts: 159

Rep: Reputation: 33
I'm glad you found a fix. I think the fact that you managed to achieve the result you wanted by setting the LC_COLLATE environment variable shows that there *was* a language/locale issue here. That environment variable overrides the value taken from the locale (see localdef(1) and /usr/share/locale/*).

By setting this to "C" you mean there is no specific language collation setting, so use the default, which is just ASCII binary ordering. So the fact that you had a different collation before hand suggests there's something strange in your locale. You could compare /usr/share/locale/* settings with your Debian installation?

Cheers,
-nick
 
Old 10-24-2007, 10:15 AM   #6
mcwasi
LQ Newbie
 
Registered: Oct 2002
Location: Vienna(AT)/Potsdam(DE)
Distribution: Debian/Ubuntu
Posts: 8

Original Poster
Rep: Reputation: 0
You're right!

When invoking locale, everything was set to C at my former debian system - and to en_US at my new ubuntu installation.

Gosh, I would have never found out without your help! Thx!

McWasi
 
Old 10-24-2007, 10:26 AM   #7
Nick_Battle
Member
 
Registered: Dec 2006
Location: Bracknell, UK
Distribution: SUSE 13.1
Posts: 159

Rep: Reputation: 33
Interesting. That may indicate that Ubuntu has an error in their en_US locale settings. It might be worth mentioning this on one of their forums...

-nick
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Upper and lower case problem when mount hardisk UltraSoul Linux - Newbie 1 10-28-2005 09:50 AM
grep [A-Z] & [a-z] match both upper and lower case. jschiwal Linux - General 4 05-28-2005 07:43 AM
Why are all my upper case files being shown as lower case?? [Kernel 2.6.9-1.667 FC3] t3gah Fedora 4 03-11-2005 05:09 PM
Lower case to upper case letter sudhasmyle Programming 1 12-03-2004 05:15 AM
Apache and upper or lower case. dsiguy Linux - General 3 02-04-2003 12:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:24 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration