Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl (http://www.velocityreviews.com/forums/f17-perl.html)
-   -   zcat output (http://www.velocityreviews.com/forums/t25434-zcat-output.html)

Me 12-28-2004 09:39 AM

zcat output
 
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

Jim Gibson 12-28-2004 05:40 PM

Re: zcat output
 
In article <vKGdnfnTu78vtEzcRVn-tA@is.co.za>, Me <me@nowehere.com>
wrote:

> 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.


----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---


All times are GMT. The time now is 12:04 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.