The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to reduce swapped column in "vmstat" unitipon SUN Solaris 2 05-14-2008 08:18 PM
Development Releases: Linux Mint 4.0 Beta "Fluxbox", 4.0 Alpha "Debian" iBot UNIX and Linux RSS News 0 01-04-2008 12:00 PM
Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" Lokesha UNIX for Dummies Questions & Answers 4 12-19-2007 10:52 PM
Debian: doubt in "top" %CPU and "sar" output jaduks Linux 0 09-12-2007 05:05 AM
Sorting problem "sort -k 16,29 sample.txt > output.txt" ganapati Shell Programming and Scripting 3 08-01-2006 02:55 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 09-20-2005
Registered User
 

Join Date: Sep 2003
Location: Paris
Posts: 109
Sorting "ls" output on more than 1 column

I would sort the "ls" output : on the 1st column then on the nineth :

ls -al |sort -k1,1 -k9,9r

this doesn't work ?

Anybody have an idea ?

regards
Christian
Reply With Quote
Forum Sponsor
  #2  
Old 09-20-2005
RTM's Avatar
RTM RTM is offline
Hog Hunter
 
Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
You need spaces between the -k and the field_start,field_end portion

ls -al |sort -k 1,1 -k 9,9r

If you are thinking that it isn't working, check again. It may be the first column (the file permissions) that makes it look like the last column (file name) isn't sorted, but it is.

Last edited by RTM; 09-20-2005 at 04:42 AM.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 09:50 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0