LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-15-2010, 09:33 AM   #1
gusblake
LQ Newbie
 
Registered: Feb 2010
Posts: 24

Rep: Reputation: 15
Include special characters when sorting files by name (Fedora 12 i386)


Hi,

I am dragging my files over to a new Fedora 12 installation and I just noticed that special characters are not taken into account when sorting files by name (I want '_js' to come before 'images').

Is there a way to make the sorting process behave like Windows, where files starting with a special character are listed first?

Cheers,
Gus
 
Old 02-15-2010, 10:16 AM   #2
berbae
Member
 
Registered: Jul 2005
Location: France
Distribution: Arch Linux
Posts: 540

Rep: Reputation: Disabled
Try :

LC_ALL=C sort [FILE]...
 
Old 02-15-2010, 11:40 AM   #3
gusblake
LQ Newbie
 
Registered: Feb 2010
Posts: 24

Original Poster
Rep: Reputation: 15
Thanks for the reply,

I tried using sort, but that's not what I need - I'm looking for a way to change the order of the directories and files themselves, eg.

in /var/www/html,

images
_js
index.php

should be:

_js (this is at the top because of the underscore)
images
index.php

is this possible?

Last edited by gusblake; 02-15-2010 at 11:42 AM.
 
Old 02-15-2010, 03:44 PM   #4
berbae
Member
 
Registered: Jul 2005
Location: France
Distribution: Arch Linux
Posts: 540

Rep: Reputation: Disabled
I don't understand exactly what you want to get.
If you want the ls command sorting to be different, try :

LC_ALL=C ls -l

You can also set the LC_ALL system wide, at boot time or at login time.
Look also at the LC_COLLATE environment variable.

If it is something else, I don't see.

Last edited by berbae; 02-15-2010 at 04:02 PM.
 
Old 02-15-2010, 11:15 PM   #5
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Quote:
Originally Posted by gusblake View Post
I'm looking for a way to change the order of the directories and files themselves
There is no "ordering" of file-and-directory entries in directories. I guess the order is the result of creation and deletion history, programmed for performance. You can see the actual order by using vdir with the -u option.

We are so used to seeing the order presented by shell filename expansion and ls that it's easy to assume the directory itself is ordered.
 
Old 02-16-2010, 07:54 AM   #6
gusblake
LQ Newbie
 
Registered: Feb 2010
Posts: 24

Original Poster
Rep: Reputation: 15
I've sorted it out now - I just wanted certain directories to appear before others regardless of their names, so I've arranged them by emblems now which does the job.

Cheers,
Gus
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
renaming files with spaces and special characters. bowens44 Linux - Newbie 8 06-29-2009 06:52 PM
Replacing lines in files that contain special characters arizonagroovejet Linux - General 3 06-22-2009 09:19 PM
not showing files or folders with special characters, like umlauts pinknyunyu Slackware 16 05-06-2009 09:16 AM
Copying files with special characters cornish Linux - Newbie 13 12-21-2007 11:22 AM
Searching for files with special characters Yig Linux - Newbie 4 11-08-2007 05:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:31 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