zcat output

M

Me

How can I get the output from 'zcat' as if I was opening a file? What I
would like to do, is go throug each line return by zcat looking for
specic patterns.

Thanks,
Newbie
 
J

Jim Gibson

Me <[email protected]> said:
How can I get the output from 'zcat' as if I was opening a file? What I
would like to do, is go throug each line return by zcat looking for
specic patterns.

open( $z, 'zcat file.gz|' ) or die("Can't open file.gz: $!");
while( <$z> ) {
if( /pattern/ ) {
#do something
}
}

You should also check out the IO::Zlib module on CPAN.

FYI: this newsgroup is defunct; try comp.lang.perl.misc in the future.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top