[KLUG Members] awk question
Adam Tauno Williams
adam at morrison-ind.com
Wed Feb 23 08:40:51 EST 2005
> Trying to get the uncompressed size of a file I've come up with
> gzip -l somezipfile.gz | awk /[0-9]+/'{print $2)'
> Now I want to know how it works.
> The output of gzip -l looks like:
> compressed uncompressed ratio uncompressed_name
> 1837372631 3201867776 42.6% somefile.txt
> And when I initially did
> gzip -l somezipfile.gz | awk '{print $2)'
> I got
> uncompressed
> 3201867776
> I didn't want the "uncompressed" string, just the number.
> Are those two results the result of awk outputting the second "word" of
> two lines?
Yes. It is assumed that whitespace is the delimiter.
> I kept trying to break them up but couldn't, and ended up
> telling awk to only keep the "word" that had numbers in it.
you could just to a gzip... | tail -1 | awk.... to just give awk the
last line.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://www.kalamazoolinux.org/pipermail/members/attachments/20050223/91fd8078/attachment.bin
More information about the Members
mailing list