[KLUG Members] awk question

bill billtron at billtronservices.com
Tue Feb 22 17:01:40 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?  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.

kind regards,

bill hollett






More information about the Members mailing list