LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Zgrep mulitple zip files (https://www.linuxquestions.org/questions/linux-newbie-8/zgrep-mulitple-zip-files-672375/)

tekvaio 09-25-2008 04:20 PM

Zgrep mulitple zip files
 
I've been stumped on this one for a bit, and I'm unable to find a solution.

What I'm trying to do is run a grep for a particular regex on a set of multiple zip files. Within each zip file there are multiple logs. For the most part these files all end with a log extension *.log.

I have tried the following but had no results.

zgrep -i 'expression' *.zip >outputfilename.OUT

but won't find anything.

After some research I'm seeing that I would only work with files that were compressed with GZ . And yes, I was successful with that.

This makes me believe that I may need to decompress these files first then grep them.

Would someone know if there an easier way without having to uncompress ?
I'm starting to read a bit about zcat, but not sure if/how if this will be useful.

Thanks,

TV

tekvaio 09-25-2008 04:31 PM

Found it
 
zcat sourcezipname | egrep -i 'pattern' >test.out

Thanks!


All times are GMT -5. The time now is 01:05 PM.