DOKK / manpages / debian 11 / zutils / zegrep.1.en
ZGREP(1) User Commands ZGREP(1)

zgrep - search compressed files for a regular expression

zgrep [options] <pattern> [files]

zgrep is a front end to the program grep that allows transparent search on any combination of compressed and uncompressed files. If any file given is compressed, its decompressed content is used. If a file given does not exist, and its name does not end with one of the known extensions, zgrep tries the compressed file names corresponding to the formats supported. If a file fails to decompress, zgrep continues searching the rest of the files.

If a file is specified as '-', data are read from standard input, decompressed if needed, and fed to grep. Data read from standard input must be of the same type; all uncompressed or all in the same compressed format.

If no files are specified, recursive searches examine the current working directory, and nonrecursive searches read standard input.

The formats supported are bzip2, gzip, lzip, and xz.

Exit status is 0 if match, 1 if no match, 2 if trouble. Some options only work if the grep program used supports them.

display this help and exit
output version information and exit
treat all files as text
print <n> lines of trailing context
print the byte offset of each line
print <n> lines of leading context
only print a count of matching lines per file
print <n> lines of output context
show matched strings in color
use <pattern> as the pattern to match
<pattern> is an extended regular expression
obtain patterns from <file>
<pattern> is a set of newline-separated strings
suppress the prefixing filename on output
print the filename for each match
ignore case distinctions
ignore binary files
only print names of files containing matches
only print names of files containing no matches
stop after <n> matches
process only the formats in <list>
print the line number of each line
don't read runtime configuration file
show only the part of a line matching <pattern>
force the format given (bz2, gz, lz, xz)
suppress all messages
operate recursively on directories
recursively follow symbolic links
suppress error messages
select non-matching lines
verbose mode (show error messages)
match only whole words
match only whole lines
set compressor and options for bzip2 format
set compressor and options for gzip format
set compressor and options for lzip format
set compressor and options for xz format

Numbers may be followed by a multiplier: k = kB = 10^3 = 1000, Ki = KiB = 2^10 = 1024, M = 10^6, Mi = 2^20, G = 10^9, Gi = 2^30, etc...

Report bugs to zutils-bug@nongnu.org
Zutils home page: http://www.nongnu.org/zutils/zutils.html

Copyright © 2021 Antonio Diaz Diaz. License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

January 2021 zutils 1.10