How to search in compressed file

This is the third post talking about compressed files. This time, we will look into how to search within the compressed file, without decompressing it.

Gnuzip compressed file :
zgrep <.tar.gz or .gz compressed file>
zgrep "load successful" today-log.tar.gz

*** there are also zegrep (extended regex grep) & fgrep (fixed-string grep) available

Bzip2 compressed file :
bzgrep <.tar.bz2 or .bz2 compressed file>
bzgrep "loaded" logs.tar.bz2

*** there are also bzegrep (extended regex grep) & bfgrep (fixed-string grep) available

Farvel !!!

No comments: