Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to List Uppercase and Lowercase???

Status
Not open for further replies.

100mbs

MIS
Feb 14, 2002
142
US

I know there is a config to insert in the /etc/system file that will allow you to see uppercase and lowercase while doing a listing. Instead by default ALL the uppercase show up at the top when doing a "ls -l" command.

The uppercase and lowercase should mix in albetical order regardless of case.


See below for example.

bash-3.00# ls -l var/
total 130
drwxr-xr-x 2 root other 512 May 13 10:55 TT_DB
drwxr-xr-x 3 root root 512 Jun 10 10:28 VRTSat
drwxr-xr-x 4 root other 512 Jun 10 09:52 VRTSweb
drwxrwxr-x 10 root sys 512 Aug 5 15:49 adm
drwxr-xr-x 9 root bin 512 May 13 12:13 apache
drwxr-xr-x 9 root bin 512 May 13 12:01 apache2
drwxr-xr-x 2 root sys 512 May 13 10:39 audit
drwxr-xr-x 3 root sys 512 May 13 12:19 cacao
drwxr-xr-x 3 root sys 512 May 13 11:47 cache
drwxr-xr-x 2 root sys 512 May 13 11:27 cc-ccr
drwxr-xr-x 3 root root 512 May 13 10:55 crash
drwxr-xr-x 2 root sys 512 May 13 10:55 cron
drwxr-xr-x 5 root sys 512 May 13 11:30 dmi
drwxr-xr-x 6 root root 1024 Aug 5 16:36 dt
drwxr-xr-x 3 root sys 512 May 13 10:39 fm
drwxr-xr-x 3 root sys 512 May 13 12:00 imq
drwxr-xr-x 2 root sys 512 May 13 10:39 inet
drwxr-xr-x 3 root sys 512 May 13 10:41 krb5
 
I disagree that uppercase and lowercase should[/b] mix in alphabetical order; I much prefer it the way you have it, however that's personal preference and it's beside the point. :)

What you need to change is the collating sequence, which is controlled by your locale settings, specifically the LC_COLLATE variable. I have only seen it sorting in the way you describe on Linux, for example when using LC_COLLATE=en_US.UTF-8. The default behaviour occurs when LC_COLLATE=C. I don't have a Solaris box handy to see whether en_US.UTF-8 has the same effect, but you can test it easily using:

Code:
$ LC_COLLATE=en_US.UTF-8 ls -l /var

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top