[KLUG Members] Re: awk question

bobm2 at wmcradmin.info bobm2 at wmcradmin.info
Sun Feb 27 08:31:05 EST 2005


Sorry I did not pick this up till this morning...

It could also be solved as follows:

gzip -l somezipfile.gz | awk '{if (NR == 2) print $2)'

Cheers,

Bob


>Date: 22 Feb 2005 17:01:40 -0500
>From: bill <billtron at billtronservices.com>
>Subject: [KLUG Members] awk question
>To: klug <members at kalamazoolinux.org>
>Message-ID: <1109109700.2378.28.camel at linux9>
>Content-Type: text/plain
>
>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