Friday, April 17, 2009

Another way to find text inside gzip files.

zgrep is another program you can use to find text inside gzip files. I've only seen it available on linux but you may find a port for other platforms. zgrep is a very handy tool for searching through gzip files. It works pretty much the same way as grep only you don't have to unzip the files.

Example:

Let's say I was searching for an IP address in apache log files.

> zgrep -e '1.2.3.4' *.gz

You can also use the -l option just like grep.

Commands used in this post: zgrep

No comments: