awk help needed
talexb-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Sat Jul 18 16:17:21 UTC 2009
On Sat, Jul 18, 2009 at 11:46 AM, Giles Orr<gilesorr-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org> wrote:
> By way of introduction: I'm finally, finally trying to get a new
> edition of the Bashprompt HOWTO out there. This will probably result
> in me posting a lot of detailed and mildly weird questions to this
> list. This is the first.
> The intention of this script is to figure out how much space the files
> in the current directory take up. There are about a million ways to
> do this - and yes, I know that "ls -l" spits out a "total" line: I
> don't know what it's totaling, but my math has never agreed with it
> ... feel free to explain though. I decided that I'd like to do this
> as much in awk as possible since it does decimal math (unlike bash)
> and it's certainly the easiest way to do the text parsing. I've tried
> bc as well, but you have to use other utility programs to parse and
> split the input for it.
Sorry, but I usually use the du command for this.
root at music:/etc/init.d# du -h .
Sometimes I want to know how heavy an entire tree is, so I use
$ du -sh foo
The 'h' argument does intelligent size management, so shows K, M and G.
The Toronto Linux Users Group. Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
More information about the Legacy