zgrep and zcat ussage

finding content in uncompressed files (extension, gzip).

In a directory, there are many .gz files, how do we search for a particular word in those files. one solution is to unzip the .gz file and use the grep command.

Here are the steps

gunzip filename.gz grep “searchword” file

The other and better solution is using zgrep command in unix

zgrep “search word” filename.gz

grep command work on text files, zgrep works on compressed logs.

To view the compressed files, use zcat command in linux or unix

Similar Posts