Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora 17/18 > Using Fedora
FedoraForum Search

Forgot Password? Join Us!

Using Fedora General support for current versions. Ask questions about Fedora and it's software that do not belong in any other forum.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 1st April 2009, 10:20 PM
jimbux's Avatar
jimbux Offline
Registered User
 
Join Date: Apr 2008
Location: Sunnyvale, CA
Age: 51
Posts: 143
Question /bin/sort -WTF

I'm having a serious WTF moment here. The following output is sorted with the command $ /bin/sort <file> where <file> contains the lines below:

Code:
a.01
a.02
a02.01
a.03
a.04
a.05
a.06
a.07
..but unless I've lost my sanity the results should be this:

Code:
a.01
a.02
a.03
a.04
a.05
a.06
a.07
a02.01
I verified this by jumping on my interix windows system, opening a csh and sorting the file. It did what I expected. It seems that the '/bin/ls' command uses sort, which is how I discovered this problem. Files were not listing as I'd expect. It's as if the sort is ignoring the '.'.

Any ideas anyone!? I can't recall seeing this behavior ever before. I just switched from using csh to bash as my shell, could this be why the behavior is different? I'm at a total loss.

Thanks,
James.
Reply With Quote
  #2  
Old 1st April 2009, 10:30 PM
jimbux's Avatar
jimbux Offline
Registered User
 
Join Date: Apr 2008
Location: Sunnyvale, CA
Age: 51
Posts: 143
Ok, ok... I just figured it out. I tried one thing, but since I'm a new bash guy, I forgot something imporant (the export).

Code:
LC_ALL=C
export LC_ALL
But seriously... WTF? (At least it works the way I expect now.)
Reply With Quote
  #3  
Old 1st April 2009, 10:35 PM
sideways's Avatar
sideways Offline
Retired User
 
Join Date: Oct 2004
Location: London, UK
Posts: 4,999
I think it changed a while ago, you can revert to the old behaviour with

Code:
export LC_ALL=POSIX
$ sort sorttest.txt 
a.01
a.02
a.03
a.04
a.05
a.06
a.07
a02.01
or the other methods you mention
Reply With Quote
Reply

Tags
or bin or sort, wtf

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
FC4 & RDP (of some sort) crp0499 Using Fedora 5 27th July 2005 03:29 PM


Current GMT-time: 01:04 (Monday, 20-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat