Skyspace, from browsing man ls, it looks like you should be able to do that 
with just a couple of extra switches in ls:

ls -1sSh

to list files in human-readable format from ordered from largest to smallest, or

ls -1sShr

to do the same in order of smallest to largest.  This worked for me in bash.  
It will sort correctly in order of K, M, G.




________________________________
From: skyspace <[email protected]>
To: Linux Users Group <[email protected]>
Sent: Wednesday, June 10, 2009 7:15:55 PM
Subject: [lug:14559] How I can sort data by size displayed in human readable 
form?


How I can sort data by size displayed in human readable form?

For example:

I can do ls -1sh | sort -n  but that mixes the 'K' and the 'M's.

I can do ls -1s | sort  -n  but that is not in human readable format.

Thanks,
skyspace.





      
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Linux Users Group.
To post a message, send email to [email protected]
To unsubscribe, send email to [email protected]
For more options, visit our group at 
http://groups.google.com/group/linuxusersgroup
-~----------~----~----~----~------~----~------~--~---

Reply via email to