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):
xxxxxxxxxx
1
zgrep 'text to find here ...' /path/to/log.gz
Where: zgrep
calls grep
with *.gz
files reading support.
xxxxxxxxxx
1
zgrep -i 'text to find here ...' /path/to/log.gz
Where:
-i
or--ignore-case
causes text matching with case insensitive ignoring.
Below command example matches digits in log.gz
file.
xxxxxxxxxx
1
zgrep -E '\d+' /path/to/log.gz
Where:
-E
runs searching in regular expression mode,'\d+'
should be changed to any regular expression.