Operating System - HP-UX
1753529 Members
5231 Online
108795 Solutions
New Discussion юеВ

Re: grep more than 1 pattern in zip files

 
Muktha
Frequent Advisor

grep more than 1 pattern in zip files

Hi all,

I want to search more than 1 pattern in zipped file . zgrep -e is not working.

Can you please help me to find out a solution?

Regards
Muktha
7 REPLIES 7
Sunny Jaisinghani
Trusted Contributor

Re: grep more than 1 pattern in zip files

Hi,

Try

zcat | grep -e "
Sunny
Muktha
Frequent Advisor

Re: grep more than 1 pattern in zip files

Thanks Sunny ...

I need to search around 10 patterns in 100 files.zcat will take time .Is there any direct command??

Regards
Muktha
Sunny Jaisinghani
Trusted Contributor

Re: grep more than 1 pattern in zip files

try

"zegrep"
Muktha
Frequent Advisor

Re: grep more than 1 pattern in zip files

Sunny,

Below is the output I am getting

ksh: zegrep: not found


Regards
Muktha
Muktha
Frequent Advisor

Re: grep more than 1 pattern in zip files

Hi ,

Is there anyway to ignore 1 file and grep in other files?

Can you help me to find out ?

Regards
Muktha
Ivan Krastev
Honored Contributor

Re: grep more than 1 pattern in zip files

Hi Muktha,

Prepare list with the filenames - find/ls to temp file, remove unwanted files from the list (skip it) and perform search/grep for patterns.

regards,
ivan
Dennis Handly
Acclaimed Contributor

Re: grep more than 1 pattern in zip files

>I need to search around 10 patterns in 100 files. zcat will take time. Is there any direct command?

Why do you think there is a way that is much faster than zcat?

zcat will of course do I/O to a pipe and that would be wasteful.

>Ivan: Prepare list with the filenames - find/ls to temp file, remove unwanted files from the list

If using real shell you can use patterns like !(foo) to get all but foo.