On 30/12/09 23:35, Juhapekka Tolvanen wrote:
Package: coreutils
Version: 8.1-1
Severity: wishlist
I wanted to do this: Give sizes of each files and directories located
in $PWD in human-readable-format AND sort output according to sizes of
those files and directories. Formerly I did it like this:
du -s * | sort -n | awk '{print $2}' | xargs du -sh
But that breaks, if file name has space or linefeed. After reading
manuals I created this:
du -s * | sort -n | cut -f 2- | tr '\n' '\0' | xargs -r0 -I "{}" du -sh "{}"
But it still breaks, if file name has linefeed.
I wanted to be sure that I get what what I want, whatever characters
file names have. Therefore I created this script:
http://iki.fi/juhtolv/hacks/sh/sortdu.sh.bz2
Some other guy created this kind of script:
http://inz.fi/sortdu2.txt
But it would be much easier, if du had some sorting functionalities.
Well sorting functionalities should be contained withing sort.
Since coretutils 7.5, sort has the -h option to directly
sort the output from du -sh
cheers,
Pádraig.
--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org