04 Apr 2013

Ever wonder how to examine data within a gzip compressed text files without uncompressed the compressed file?

Zcommands are your friends:

# the old way ...
$ gzip -d data.txt.gz
$ cat data.txt
$ less data.txt

# the new way ...
$ zless data.txt.gz

# concatenate compressed files and print on the screen:
$ zcat file.gz

# Search compressed files for a regular expression:
$ zegrep -w '^word1|word2' file.gz
$ zgrep 'word' file.gz