LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Activating case sensitivity in `sort' command? (https://www.linuxquestions.org/questions/linux-general-1/activating-case-sensitivity-in-%60sort-command-197686/)

wirawan0 06-25-2004 02:14 PM

Activating case sensitivity in `sort' command?
 
Hi,
This may be a stupid question. I used Mandrake LInux 10. I tried to do `ls | sort', and here's what it gives:

Code:

~/logs/sync-wirawan0/wirawan0 $ (LC_ALL=C; LANG=C; ls |sort )
fsdiff-after-sync-20040623.txt
fsdiff-after-sync-20040623.txt~
MD5-BigVaults.diff-to-wp.diff
MD5-BigVaults.diff-to-wp.diff~
MD5-BigVaults.txt
MD5-Personal.txt
MD5-photos.txt
MD5-Projects.diff-to-wp.diff
MD5-Projects.diff-to-wp.diff~
MD5-Projects.txt
md5-unsorted
MD5-Work.diff-to-wp.diff
MD5-Work.diff-to-wp.diff~
MD5-Work.txt
TOC-BigVault.txt
TOC-Personal.txt
TOC-photos.before-sync.txt
TOC-photos.txt
TOC-Projects.txt
TOC-Work.txt

Why is the sorting order not CASE-SenSitiVE? It should have been case sensitive, because I didn't use the `-f' switch. Could someone help? This problem happens on my Mandrake box. It didn't happen with Redhat 9 box! I must have messed up somewhere. See that I've tried to fallback to "C" locale, if it may help.

Wirawan

druuna 06-25-2004 02:32 PM

Just a wild guess:

Is -f (--ignore-case) automatically aliassed?

alias sort could give an answer to that.

wirawan0 06-25-2004 05:10 PM

No, no. Of course not. I've checked that. :-)

J.W. 06-25-2004 08:20 PM

I don't want to either answer incorrectly or make a fool out of myself, so let me ask this first: Using the same example, how do you desire the results to look? -- J.W.

wirawan0 06-26-2004 10:20 AM

I think, if the case-sensitivity is correct, it should have been like this:

MD5-BigVaults.diff-to-wp.diff
MD5-BigVaults.diff-to-wp.diff~
MD5-BigVaults.txt
MD5-Personal.txt
MD5-Projects.diff-to-wp.diff
MD5-Projects.diff-to-wp.diff~
MD5-Projects.txt
MD5-Work.diff-to-wp.diff
MD5-Work.diff-to-wp.diff~
MD5-Work.txt
MD5-photos.txt
TOC-BigVault.txt
TOC-Personal.txt
TOC-Projects.txt
TOC-Work.txt
TOC-photos.before-sync.txt
TOC-photos.txt
fsdiff-after-sync-20040623.txt
fsdiff-after-sync-20040623.txt~
md5-unsorted

That is, it was sorted from A-Z, then a-z. Why? Since the character code of A-Z is lower (smaller) than a-z.


All times are GMT -5. The time now is 02:06 AM.