Searching Multiple file using zgrep

find -name \*.eml.gz -print0 | xargs -0 zgrep "STRING"

You have to escape the first ‘*’ so that the shell does not interpret it. “-print0” tells find to print a null character after each file it finds; “xargs -0” reads from standard input and runs the command after it for each file; “zgrep” works like “grep”, but uncompresses the file first.

Added for myself  for quick info from here:

http://unix.stackexchange.com/questions/187742/how-do-i-grep-recursively-through-gz-files

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s