[CLUE-Tech] Grepping bzipped files

Timothy C. Klein teece at silverklein.net
Mon Jun 10 21:02:47 MDT 2002


* Matt Gushee (mgushee at havenrock.com) wrote:
> Hi, all--
> 
> I'm a packrat when it comes to e-mail. I save *everything*, probably way
> longer than I should. And when stuff gets more than a couple of months
> old, I bzip2 it to save space. But now and then I need to find some info
> in an old mailbox, and often I don't know which one.
> 
> Of course I could decompress everything and grep in the normal way, but
> that's a big pain in the arse. Does anybody know a grep-like program
> that will find strings in a bzipped file, or a convenient pipeline of
> regular commands that will accomplish the same purpose?
> 

After the file is compressed, you can just use bzcat with regular grep

bzcat mbox.bz2 | grep loveletter

bzcat (an analog of zcat) just writes the file to standard out, like cat
would, but it bunzip2's first (ha, that's a funny verb, bunzip2).

HTH,

Tim
--
==============================================
== Timothy Klein || teece at silverklein.net   ==
== ---------------------------------------- ==
== "Hello, World" 17 Errors, 31 Warnings... ==
==============================================



More information about the clue-tech mailing list