You don't need to use the sort command at all.
I think this is what you're after:
ls -lSh # gets you a listing by size in Descending order
or
ls -lSrh # gets you a listing by size in Ascending order
If you want to limit the output to certain columns,
such as the filenames and their sizes,
then use awk to filter and format the output.
John
skyspace wrote:
> 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
-~----------~----~----~----~------~----~------~--~---