Grepping through .gz log files

The zgrep program is available for Linux (and perhaps some Unix too). This will decompress the files and then grep through them.


Should you for some reason lack zgrep you can do the same thing with gunzip and a pipe:

gunzip -c <filename.gz> | grep <whatever you want to grep for>

You can just use zgrep to grep through compressed files.

If you need to use a specific grep, you can set the GREP environment variable:

export GREP=/bin/egrep

How about zgrep? Seems to be installed on Mac OS and Ubuntu 11.04.