Logan Hansen wrote:
I would like to request a feature to be added to the 'du' command:

a command line switch to sort output by directory name or by size of directory

option to sort by size... wow, that would be really nice.

So nice I wrote this script to do it...

du -B 1 "$@" | awk '{printf "%012i %s\n", $1, $2}' | sort | awk '
{
        if ( $1 > 0x3F000000 )
                printf "%6.1fG  ", $1 / 0x40000000 ;
        else if ( $1 > 0xF0000 )
                printf "%6.1fM  ", $1 / 0x100000 ;
        else if ( $1 > 0x300 )
                printf "%6.1fK  ", $1 / 0x400 ;
        else
                printf "%6i   ", $1 ;
        $1="" ;
        print $0 ;
}'

...but having 'du' do it would be so much nicer.

--
Matthew
"Try to bring it back in one piece this time." -- Q (MI6)



_______________________________________________
Bug-coreutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to