The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
filesize infyanurag Shell Programming and Scripting 3 05-15-2008 05:00 AM
UNIX and filesize ndoggy020 UNIX for Dummies Questions & Answers 3 12-06-2007 04:14 PM
How to truncate as filesize? Lestat Shell Programming and Scripting 1 06-07-2005 03:24 PM
FileSize ??? Cameron Shell Programming and Scripting 3 05-28-2002 10:34 PM
filesize jmg5 Shell Programming and Scripting 2 02-13-2002 07:51 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-04-2002
peter.herlihy peter.herlihy is offline
Registered User
  
 

Join Date: Nov 2001
Location: New Zealand
Posts: 333
Sorting ls by filesize

I saw some stuff in the search results on this - but nothing specific.....

I have a significant number of files (c. 300) which are output from a large process that I run. These are compared with a 'baselined' set of files - so I can quickly see if there are differences based on the sizes of the files.

I want to sort the directory into filesize...and not by number of lines. I need byte size to confirm differences.

I've thought about awk, wc -c, I've looked at sort -n ....and I've looked at the ls options...but I cant seem to get a combination to work for me.

ideas? And Yeah I realise I could cut the filesize from the ls and sort by that....but there must be a simpler way....

(Oh and I work with SunOS 5.6 and typically use a bash shell).
  #2 (permalink)  
Old 06-04-2002
manderson19 manderson19 is offline
Registered User
  
 

Join Date: Aug 2001
Posts: 57
try:

ls -al | sort -rn +4

this does a reverse numerical sort by file size. hope this helps.
  #3 (permalink)  
Old 06-04-2002
peter.herlihy peter.herlihy is offline
Registered User
  
 

Join Date: Nov 2001
Location: New Zealand
Posts: 333
Spot on - thanks.
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:23 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0