EN
grep - search text in gzipped file
8
points
In this short article, we would like to show how to find any text in gzipped text file (*.gz files) using grep command in Bash.
Quick solution (run the following command):
zgrep 'text to find here ...' /path/to/log.gz
Where: zgrep calls grep with *.gz files reading support.
Orher examples
1. Searching with case insensitive
zgrep -i 'text to find here ...' /path/to/log.gz
Where:
-ior--ignore-casecauses text matching with case insensitive ignoring.
2. Searching with regular expressions
Below command example matches digits in log.gz file.
zgrep -E '\d+' /path/to/log.gz
Where:
-Eruns searching in regular expression mode,'\d+'should be changed to any regular expression.