summaryrefslogtreecommitdiffstats
path: root/doc/zgrep.1
blob: dd5699f4ca79d33f22d714a160ef76406957cfe9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
.\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.49.2.
.TH ZGREP "1" "December 2023" "zutils 1.13-rc1" "User Commands"
.SH NAME
zgrep \- search compressed files for a regular expression
.SH SYNOPSIS
.B zgrep
[\fI\,options\/\fR] \fI\,<pattern> \/\fR[\fI\,files\/\fR]
.SH DESCRIPTION
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 until one is found. If a file fails to decompress, zgrep
continues searching the rest of the files.
.PP
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.
.PP
If no files are specified, recursive searches examine the current
working directory, and nonrecursive searches read standard input.
.PP
\&'zgrep \fB\-\-verbose\fR \fB\-V\fR' prints the version of the grep program used.
.PP
The formats supported are bzip2, gzip, lzip, xz, and zstd.
.PP
Exit status is 0 if match, 1 if no match, 2 if trouble.
Some options only work if the grep program used supports them.
.SH OPTIONS
.TP
\fB\-\-help\fR
display this help and exit
.TP
\fB\-V\fR, \fB\-\-version\fR
output version information and exit
.TP
\fB\-a\fR, \fB\-\-text\fR
treat all files as text
.TP
\fB\-A\fR, \fB\-\-after\-context=\fR<n>
print <n> lines of trailing context
.TP
\fB\-b\fR, \fB\-\-byte\-offset\fR
print the byte offset of each line
.TP
\fB\-B\fR, \fB\-\-before\-context=\fR<n>
print <n> lines of leading context
.TP
\fB\-c\fR, \fB\-\-count\fR
only print a count of matching lines per file
.TP
\fB\-C\fR, \fB\-\-context=\fR<n>
print <n> lines of output context
.TP
\fB\-\-color[=\fR<when>]
show matched strings in color
.TP
\fB\-e\fR, \fB\-\-regexp=\fR<pattern>
use <pattern> as the pattern to match
.TP
\fB\-E\fR, \fB\-\-extended\-regexp\fR
<pattern> is an extended regular expression
.TP
\fB\-f\fR, \fB\-\-file=\fR<file>
obtain patterns from <file>
.TP
\fB\-F\fR, \fB\-\-fixed\-strings\fR
<pattern> is a set of newline\-separated strings
.TP
\fB\-G\fR, \fB\-\-basic\-regexp\fR
<pattern> is a basic regular expression (default)
.TP
\fB\-h\fR, \fB\-\-no\-filename\fR
suppress the prefixing file name on output
.TP
\fB\-H\fR, \fB\-\-with\-filename\fR
print the file name for each match
.TP
\fB\-i\fR, \fB\-\-ignore\-case\fR
ignore case distinctions
.TP
\fB\-I\fR
ignore binary files
.TP
\fB\-l\fR, \fB\-\-files\-with\-matches\fR
only print names of files containing matches
.TP
\fB\-L\fR, \fB\-\-files\-without\-match\fR
only print names of files containing no matches
.TP
\fB\-\-label=\fR<label>
use <label> as file name for standard input
.TP
\fB\-\-line\-buffered\fR
flush output on every line
.TP
\fB\-m\fR, \fB\-\-max\-count=\fR<n>
stop after <n> matches
.TP
\fB\-M\fR, \fB\-\-format=\fR<list>
process only the formats in <list>
.TP
\fB\-n\fR, \fB\-\-line\-number\fR
print the line number of each line
.TP
\fB\-N\fR, \fB\-\-no\-rcfile\fR
don't read runtime configuration file
.TP
\fB\-o\fR, \fB\-\-only\-matching\fR
show only the part of a line matching <pattern>
.TP
\fB\-O\fR, \fB\-\-force\-format=\fR<fmt>
force the input format
.TP
\fB\-P\fR, \fB\-\-perl\-regexp\fR
<pattern> is a Perl regular expression
.TP
\fB\-q\fR, \fB\-\-quiet\fR, \fB\-\-silent\fR
suppress all messages
.TP
\fB\-r\fR, \fB\-\-recursive\fR
operate recursively on directories
.TP
\fB\-R\fR, \fB\-\-dereference\-recursive\fR
recursively follow symbolic links
.TP
\fB\-s\fR, \fB\-\-no\-messages\fR
suppress error messages
.TP
\fB\-T\fR, \fB\-\-initial\-tab\fR
make tabs line up (if needed)
.TP
\fB\-U\fR, \fB\-\-binary\fR
don't strip CR characters at EOL (DOS/Windows)
.TP
\fB\-v\fR, \fB\-\-invert\-match\fR
select non\-matching lines
.TP
\fB\-\-verbose\fR
verbose mode (show error messages)
.TP
\fB\-w\fR, \fB\-\-word\-regexp\fR
match only whole words
.TP
\fB\-x\fR, \fB\-\-line\-regexp\fR
match only whole lines
.TP
\fB\-Z\fR, \fB\-\-null\fR
print 0 byte (ASCII NUL) after file name
.TP
\fB\-\-bz2=\fR<command>
set compressor and options for bzip2 format
.TP
\fB\-\-gz=\fR<command>
set compressor and options for gzip format
.TP
\fB\-\-lz=\fR<command>
set compressor and options for lzip format
.TP
\fB\-\-xz=\fR<command>
set compressor and options for xz format
.TP
\fB\-\-zst=\fR<command>
set compressor and options for zstd format
.PP
Valid formats for options '\-M' and '\-O' are 'bz2', 'gz', 'lz', 'xz', 'zst',
and 'un' for uncompressed.
.PP
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...
.SH "REPORTING BUGS"
Report bugs to zutils\-bug@nongnu.org
.br
Zutils home page: http://www.nongnu.org/zutils/zutils.html
.SH COPYRIGHT
Copyright \(co 2023 Antonio Diaz Diaz.
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
.br
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
.SH "SEE ALSO"
The full documentation for
.B zgrep
is maintained as a Texinfo manual.  If the
.B info
and
.B zgrep
programs are properly installed at your site, the command
.IP
.B info zutils
.PP
should give you access to the complete manual.