bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: du feature request


From: Matthew Woehlke
Subject: Re: du feature request
Date: Thu, 19 Oct 2006 16:53:56 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.7) Gecko/20060909 Thunderbird/1.5.0.7 Mnenhy/0.7.4.0

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)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]