[KLUG Members] method of grep list of .gz files?

Scott Wood treii28 at yahoo.com
Thu Nov 25 10:04:58 EST 2004


zcat is nothing but an uncompress piped out to stdout.  gz has similar
parameters (gzip -dc) and similarly for bzip2 (bzip2 -dc).  'd' for decompress,
'c' for cat to stdout.

For stuff like what you speak of, if it's a quick fix, you could build a simple
shell script with an for loop and an 'if' clause.  (I'm not in front of my *nix
box right now, but if you check the grep manpage, there's even a way to get it
to report a simple 'true'... -q or something like that, as well as a 'count' of
matches... -c ?)  If they are on seperate trees, check out 'find [path] -type f
-name \*.gz' to seed your for loop with filenames.

Of course, if it's more than just a dirty quick-shot, I would do it in perl
with the Gzip cpan libs.

SW

--- Richard Harding <rick at ricksweb.info> wrote:

> I have set up a postfix mail server with amavis-new and spamassassin and 
> it quarantines spam and saves them as these spam-MESSAGSEID.gz files. I 
> want to check and see if any of these are from a specific user account 
> and am looking for a way to grep USERNAME *.gz in that directory.
> 
> I had seen on another site using zcat for some messages, but it doesn't 
> work for .gz files. Does anyone know a way I can accomplish this short 
> of unzipping all of the files into /tmp and then greping them all from 
> there?
> 
> Thanks
> 
> Rick
> _______________________________________________
> Members mailing list
> Members at kalamazoolinux.org
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the Members mailing list