LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   ls sorting problem: lower and upper case folded? (https://www.linuxquestions.org/questions/linux-general-1/ls-sorting-problem-lower-and-upper-case-folded-594175/)

mcwasi 10-24-2007 07:16 AM

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

Nick_Battle 10-24-2007 07:24 AM

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?

b0uncer 10-24-2007 07:31 AM

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

mcwasi 10-24-2007 08:30 AM

Quote:

Originally Posted by b0uncer (Post 2934861)
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!

Nick_Battle 10-24-2007 08:52 AM

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

mcwasi 10-24-2007 09:15 AM

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

Nick_Battle 10-24-2007 09:26 AM

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


All times are GMT -5. The time now is 05:22 AM.