Deleted Added
full compact
grep.texi (53564) grep.texi (55360)
1\input texinfo @c -*-texinfo-*-
2@c %**start of header
3@setfilename grep.info
4@settitle grep, print lines matching a pattern
5@c %**end of header
6
7@c This file has the new style title page commands.
8@c Run `makeinfo' rather than `texinfo-format-buffer'.

--- 8 unchanged lines hidden (view full) ---

17
18@c Combine indices.
19@syncodeindex ky cp
20@syncodeindex pg cp
21@syncodeindex tp cp
22
23@defcodeindex op
24@syncodeindex op fn
1\input texinfo @c -*-texinfo-*-
2@c %**start of header
3@setfilename grep.info
4@settitle grep, print lines matching a pattern
5@c %**end of header
6
7@c This file has the new style title page commands.
8@c Run `makeinfo' rather than `texinfo-format-buffer'.

--- 8 unchanged lines hidden (view full) ---

17
18@c Combine indices.
19@syncodeindex ky cp
20@syncodeindex pg cp
21@syncodeindex tp cp
22
23@defcodeindex op
24@syncodeindex op fn
25@syncodeindex vr fn
25
26@ifinfo
27@direntry
28* grep: (grep). print lines matching a pattern.
29@end direntry
26
27@ifinfo
28@direntry
29* grep: (grep). print lines matching a pattern.
30@end direntry
30This file documents @sc{grep}, a pattern matching engine.
31This file documents @command{grep}, a pattern matching engine.
31
32
33Published by the Free Software Foundation,
3459 Temple Place - Suite 330
35Boston, MA 02111-1307, USA
36
32
33
34Published by the Free Software Foundation,
3559 Temple Place - Suite 330
36Boston, MA 02111-1307, USA
37
37Copyright (C) 1998 Free Software Foundation, Inc.
38Copyright 1999 Free Software Foundation, Inc.
38
39Permission is granted to make and distribute verbatim copies of
40this manual provided the copyright notice and this permission notice
41are preserved on all copies.
42
43@ignore
44Permission is granted to process this file through TeX and print the
45results, provided the printed document carries copying permission

--- 16 unchanged lines hidden (view full) ---

62
63@titlepage
64@title grep, searching for a pattern
65@subtitle version @value{VERSION}, @value{UPDATED}
66@author Alain Magloire et al.
67
68@page
69@vskip 0pt plus 1filll
39
40Permission is granted to make and distribute verbatim copies of
41this manual provided the copyright notice and this permission notice
42are preserved on all copies.
43
44@ignore
45Permission is granted to process this file through TeX and print the
46results, provided the printed document carries copying permission

--- 16 unchanged lines hidden (view full) ---

63
64@titlepage
65@title grep, searching for a pattern
66@subtitle version @value{VERSION}, @value{UPDATED}
67@author Alain Magloire et al.
68
69@page
70@vskip 0pt plus 1filll
70Copyright @copyright{} 1998 Free Software Foundation, Inc.
71Copyright @copyright{} 1999 Free Software Foundation, Inc.
71
72@sp 2
73Published by the Free Software Foundation, @*
7459 Temple Place - Suite 330, @*
75Boston, MA 02111-1307, USA
76
77Permission is granted to make and distribute verbatim copies of
78this manual provided the copyright notice and this permission notice

--- 8 unchanged lines hidden (view full) ---

87into another language, under the above conditions for modified versions,
88except that this permission notice may be stated in a translation approved
89by the Foundation.
90
91@end titlepage
92@page
93
94
72
73@sp 2
74Published by the Free Software Foundation, @*
7559 Temple Place - Suite 330, @*
76Boston, MA 02111-1307, USA
77
78Permission is granted to make and distribute verbatim copies of
79this manual provided the copyright notice and this permission notice

--- 8 unchanged lines hidden (view full) ---

88into another language, under the above conditions for modified versions,
89except that this permission notice may be stated in a translation approved
90by the Foundation.
91
92@end titlepage
93@page
94
95
95@node Top, Introduction, (dir), (dir)
96@comment node-name, next, previous, up
96@ifnottex
97@node Top
98@top Grep
97
99
98@ifinfo
99This document was produced for version @value{VERSION} of @sc{GNU} @sc{grep}.
100@end ifinfo
100@command{grep} searches for lines matching a pattern.
101
101
102This document was produced for version @value{VERSION} of @sc{gnu}
103@command{grep}.
104@end ifnottex
105
102@menu
103* Introduction:: Introduction.
106@menu
107* Introduction:: Introduction.
104* Invoking:: Invoking @sc{grep}; description of options.
105* Diagnostics:: Exit status returned by @sc{grep}.
106* Grep Programs:: @sc{grep} programs.
108* Invoking:: Invoking @command{grep}; description of options.
109* Diagnostics:: Exit status returned by @command{grep}.
110* Grep Programs:: @command{grep} programs.
107* Regular Expressions:: Regular Expressions.
111* Regular Expressions:: Regular Expressions.
112* Usage:: Examples.
108* Reporting Bugs:: Reporting Bugs.
109* Concept Index:: A menu with all the topics in this manual.
113* Reporting Bugs:: Reporting Bugs.
114* Concept Index:: A menu with all the topics in this manual.
110* Index:: A menu with all @sc{grep} commands
115* Index:: A menu with all @command{grep} commands
111 and command-line options.
112@end menu
113
114
116 and command-line options.
117@end menu
118
119
115@node Introduction, Invoking, Top, Top
116@comment node-name, next, previous, up
120@node Introduction
117@chapter Introduction
118
119@cindex Searching for a pattern.
121@chapter Introduction
122
123@cindex Searching for a pattern.
120@sc{grep} searches the input files for lines containing a match to a given
124
125@command{grep} searches the input files
126for lines containing a match to a given
121pattern list. When it finds a match in a line, it copies the line to standard
122output (by default), or does whatever other sort of output you have requested
127pattern list. When it finds a match in a line, it copies the line to standard
128output (by default), or does whatever other sort of output you have requested
123with options. @sc{grep} expects to do the matching on text.
129with options. @command{grep} expects to do the matching on text.
124Since newline is also a separator for the list of patterns, there
125is no way to match newline characters in a text.
126
130Since newline is also a separator for the list of patterns, there
131is no way to match newline characters in a text.
132
127@node Invoking, Diagnostics, Introduction, Top
128@comment node-name, next, previous, up
129@chapter Invoking @sc{grep}
133@node Invoking
134@chapter Invoking @command{grep}
130
135
131@sc{grep} comes with a rich set of options from POSIX.2 and GNU extensions.
136@command{grep} comes with a rich set of options from @sc{posix.2} and @sc{gnu}
137extensions.
132
133@table @samp
134
135@item -c
136@itemx --count
137@opindex -c
138@opindex -count
139@cindex counting lines
140Suppress normal output; instead print a count of matching
138
139@table @samp
140
141@item -c
142@itemx --count
143@opindex -c
144@opindex -count
145@cindex counting lines
146Suppress normal output; instead print a count of matching
141lines for each input file. With the @samp{-v}, @samp{--revert-match} option,
147lines for each input file. With the @samp{-v}, @samp{--invert-match} option,
142count non-matching lines.
143
144@item -e @var{pattern}
145@itemx --regexp=@var{pattern}
146@opindex -e
147@opindex --regexp=@var{pattern}
148@cindex pattern list
148count non-matching lines.
149
150@item -e @var{pattern}
151@itemx --regexp=@var{pattern}
152@opindex -e
153@opindex --regexp=@var{pattern}
154@cindex pattern list
149Use @var{pattern} as the pattern; useful to protect patterns
155Use @var{pattern} as the pattern; useful to protect patterns
150beginning with a @samp{-}.
151
156beginning with a @samp{-}.
157
152@item -f @var{file}
158@item -f @var{file}
153@itemx --file=@var{file}
159@itemx --file=@var{file}
154@opindex -f
155@opindex --file
160@opindex -f
161@opindex --file
156@cindex pattern from file
162@cindex pattern from file
157Obtain patterns from @var{file}, one per line. The empty
163Obtain patterns from @var{file}, one per line. The empty
158file contains zero patterns, and therefore matches nothing.
159
160@item -i
161@itemx --ignore-case
162@opindex -i
163@opindex --ignore-case
164@cindex case insensitive search
164file contains zero patterns, and therefore matches nothing.
165
166@item -i
167@itemx --ignore-case
168@opindex -i
169@opindex --ignore-case
170@cindex case insensitive search
165Ignore case distinctions in both the pattern and the input files.
171Ignore case distinctions in both the pattern and the input files.
166
167@item -l
168@itemx --files-with-matches
169@opindex -l
170@opindex --files-with-matches
171@cindex names of matching files
172
173@item -l
174@itemx --files-with-matches
175@opindex -l
176@opindex --files-with-matches
177@cindex names of matching files
172Suppress normal output; instead print the name of each input
173file from which output would normally have been printed.
178Suppress normal output; instead print the name of each input
179file from which output would normally have been printed.
174The scanning of every file will stop on the first match.
175
176@item -n
177@itemx --line-number
178@opindex -n
179@opindex --line-number
180@cindex line numbering
180The scanning of every file will stop on the first match.
181
182@item -n
183@itemx --line-number
184@opindex -n
185@opindex --line-number
186@cindex line numbering
181Prefix each line of output with the line number within its input file.
187Prefix each line of output with the line number within its input file.
182
183@item -q
184@itemx --quiet
185@itemx --silent
186@opindex -q
187@opindex --quiet
188@opindex --silent
189@cindex quiet, silent
188
189@item -q
190@itemx --quiet
191@itemx --silent
192@opindex -q
193@opindex --quiet
194@opindex --silent
195@cindex quiet, silent
190Quiet; suppress normal output. The scanning of every file will stop on
196Quiet; suppress normal output. The scanning of every file will stop on
191the first match. Also see the @samp{-s} or @samp{--no-messages} option.
192
193@item -s
194@itemx --no-messages
195@opindex -s
196@opindex --no-messages
197@cindex suppress error messages
198Suppress error messages about nonexistent or unreadable files.
197the first match. Also see the @samp{-s} or @samp{--no-messages} option.
198
199@item -s
200@itemx --no-messages
201@opindex -s
202@opindex --no-messages
203@cindex suppress error messages
204Suppress error messages about nonexistent or unreadable files.
199Portability note: unlike GNU @sc{grep}, BSD @sc{grep} does not comply
200with POSIX.2, because BSD @sc{grep} lacks a @samp{-q} option and its
201@samp{-s} option behaves like GNU @sc{grep}'s @samp{-q} option. Shell
202scripts intended to be portable to BSD @sc{grep} should avoid both
205Portability note: unlike @sc{gnu} @command{grep}, traditional
206@command{grep} did not conform to @sc{posix.2}, because traditional
207@command{grep} lacked a @samp{-q} option and its @samp{-s} option behaved
208like @sc{gnu} @command{grep}'s @samp{-q} option. Shell scripts intended
209to be portable to traditional @command{grep} should avoid both
203@samp{-q} and @samp{-s} and should redirect
204output to @file{/dev/null} instead.
205
206@item -v
210@samp{-q} and @samp{-s} and should redirect
211output to @file{/dev/null} instead.
212
213@item -v
207@itemx --revert-match
214@itemx --invert-match
208@opindex -v
215@opindex -v
209@opindex --revert-match
210@cindex revert matching
216@opindex --invert-match
217@cindex invert matching
211@cindex print non-matching lines
218@cindex print non-matching lines
212Invert the sense of matching, to select non-matching lines.
219Invert the sense of matching, to select non-matching lines.
213
214@item -x
215@itemx --line-regexp
216@opindex -x
217@opindex --line-regexp
218@cindex match the whole line
220
221@item -x
222@itemx --line-regexp
223@opindex -x
224@opindex --line-regexp
225@cindex match the whole line
219Select only those matches that exactly match the whole line.
226Select only those matches that exactly match the whole line.
220
221@end table
222
227
228@end table
229
223@section GNU Extensions
230@section @sc{gnu} Extensions
224
225@table @samp
226
227@item -A @var{num}
228@itemx --after-context=@var{num}
229@opindex -A
230@opindex --after-context
231@cindex after context
232@cindex context lines, after match
233Print @var{num} lines of trailing context after matching lines.
234
235@item -B @var{num}
236@itemx --before-context=@var{num}
237@opindex -B
238@opindex --before-context
239@cindex before context
240@cindex context lines, before match
241Print @var{num} lines of leading context before matching lines.
242
231
232@table @samp
233
234@item -A @var{num}
235@itemx --after-context=@var{num}
236@opindex -A
237@opindex --after-context
238@cindex after context
239@cindex context lines, after match
240Print @var{num} lines of trailing context after matching lines.
241
242@item -B @var{num}
243@itemx --before-context=@var{num}
244@opindex -B
245@opindex --before-context
246@cindex before context
247@cindex context lines, before match
248Print @var{num} lines of leading context before matching lines.
249
243@item -C
244@itemx --context@var{[=num]}
250@item -C @var{num}
251@itemx --context=[@var{num}]
245@opindex -C
246@opindex --context
247@cindex context
248Print @var{num} lines (default 2) of output context.
249
250
252@opindex -C
253@opindex --context
254@cindex context
255Print @var{num} lines (default 2) of output context.
256
257
251@item -NUM
258@item -@var{num}
252@opindex -NUM
259@opindex -NUM
253Same as @samp{--context=@var{num}} lines of leading and trailing
260Same as @samp{--context=@var{num}} lines of leading and trailing
254context. However, grep will never print any given line more than once.
255
256
257@item -V
258@itemx --version
259@opindex -V
260@opindex --version
261@cindex Version, printing
261context. However, grep will never print any given line more than once.
262
263
264@item -V
265@itemx --version
266@opindex -V
267@opindex --version
268@cindex Version, printing
262Print the version number of @sc{grep} to the standard output stream.
263This version number should be included in all bug reports.
269Print the version number of @command{grep} to the standard output stream.
270This version number should be included in all bug reports.
264
265@item --help
266@opindex --help
267@cindex Usage summary, printing
268Print a usage message briefly summarizing these command-line options
269and the bug-reporting address, then exit.
270
271@item -b
272@itemx --byte-offset
273@opindex -b
274@opindex --byte-offset
275@cindex byte offset
276Print the byte offset within the input file before each line of output.
271
272@item --help
273@opindex --help
274@cindex Usage summary, printing
275Print a usage message briefly summarizing these command-line options
276and the bug-reporting address, then exit.
277
278@item -b
279@itemx --byte-offset
280@opindex -b
281@opindex --byte-offset
282@cindex byte offset
283Print the byte offset within the input file before each line of output.
277When @sc{grep} runs on MS-DOS or MS-Windows, the printed byte offsets
284When @command{grep} runs on @sc{ms-dos} or MS-Windows, the printed
285byte offsets
278depend on whether the @samp{-u} (@samp{--unix-byte-offsets}) option is
279used; see below.
280
281@item -d @var{action}
282@itemx --directories=@var{action}
286depend on whether the @samp{-u} (@samp{--unix-byte-offsets}) option is
287used; see below.
288
289@item -d @var{action}
290@itemx --directories=@var{action}
283@opindex -d
291@opindex -d
284@opindex --directories
285@cindex directory search
292@opindex --directories
293@cindex directory search
286If an input file is a directory, use @var{action} to process it.
287By default, @var{action} is @samp{read}, which means that directories are
288read just as if they were ordinary files (some operating systems
289and filesystems disallow this, and will cause @sc{grep} to print error
294If an input file is a directory, use @var{action} to process it.
295By default, @var{action} is @samp{read}, which means that directories are
296read just as if they were ordinary files (some operating systems
297and filesystems disallow this, and will cause @command{grep} to print error
290messages for every directory). If @var{action} is @samp{skip},
291directories are silently skipped. If @var{action} is @samp{recurse},
298messages for every directory). If @var{action} is @samp{skip},
299directories are silently skipped. If @var{action} is @samp{recurse},
292@sc{grep} reads all files under each directory, recursively; this is
300@command{grep} reads all files under each directory, recursively; this is
293equivalent to the @samp{-r} option.
294
301equivalent to the @samp{-r} option.
302
303@item -H
304@itemx --with-filename
305@opindex -H
306@opindex --With-filename
307@cindex with filename prefix
308Print the filename for each match.
309
295@item -h
296@itemx --no-filename
297@opindex -h
298@opindex --no-filename
299@cindex no filename prefix
300Suppress the prefixing of filenames on output when multiple files are searched.
301
302@item -L
303@itemx --files-without-match
304@opindex -L
305@opindex --files-without-match
306@cindex files which don't match
310@item -h
311@itemx --no-filename
312@opindex -h
313@opindex --no-filename
314@cindex no filename prefix
315Suppress the prefixing of filenames on output when multiple files are searched.
316
317@item -L
318@itemx --files-without-match
319@opindex -L
320@opindex --files-without-match
321@cindex files which don't match
307Suppress normal output; instead print the name of each input
308file from which no output would normally have been printed.
309The scanning of every file will stop on the first match.
322Suppress normal output; instead print the name of each input
323file from which no output would normally have been printed.
324The scanning of every file will stop on the first match.
310
311@item -a
312@itemx --text
313@opindex -a
314@opindex --text
315@cindex suppress binary data
316@cindex binary files
325
326@item -a
327@itemx --text
328@opindex -a
329@opindex --text
330@cindex suppress binary data
331@cindex binary files
317Do not suppress output lines that contain binary data.
318Normally, if the first few bytes of a file indicate
332Do not suppress output lines that contain binary data.
333Normally, if the first few bytes of a file indicate
319that the file contains binary data, grep outputs only a
320message saying that the file matches the pattern. This
334that the file contains binary data, grep outputs only a
335message saying that the file matches the pattern. This
321option causes grep to act as if the file is a text
336option causes grep to act as if the file is a text
322file, even if it would otherwise be treated as binary.
337file, even if it would otherwise be treated as binary.
323@emph{Warning:} the result might be binary garbage
324printed to the terminal, which can have nasty
338@emph{Warning:} the result might be binary garbage
339printed to the terminal, which can have nasty
325side-effects if the terminal driver interprets some of
326it as commands.
327
328@item -w
329@itemx --word-regexp
330@opindex -w
331@opindex --word-regexp
332@cindex matching whole words
340side-effects if the terminal driver interprets some of
341it as commands.
342
343@item -w
344@itemx --word-regexp
345@opindex -w
346@opindex --word-regexp
347@cindex matching whole words
333Select only those lines containing matches that form
334whole words. The test is that the matching substring
335must either be at the beginning of the line, or preceded
348Select only those lines containing matches that form
349whole words. The test is that the matching substring
350must either be at the beginning of the line, or preceded
336by a non-word constituent character. Similarly,
337it must be either at the end of the line or followed by
351by a non-word constituent character. Similarly,
352it must be either at the end of the line or followed by
338a non-word constituent character. Word-constituent
353a non-word constituent character. Word-constituent
339characters are letters, digits, and the underscore.
340
341@item -r
342@itemx --recursive
343@opindex -r
344@opindex --recursive
345@cindex recursive search
346@cindex searching directory trees

--- 7 unchanged lines hidden (view full) ---

354Obsolete synonym for @samp{-i}.
355
356@item -U
357@itemx --binary
358@opindex -U
359@opindex --binary
360@cindex DOS/Windows binary files
361@cindex binary files, DOS/Windows
354characters are letters, digits, and the underscore.
355
356@item -r
357@itemx --recursive
358@opindex -r
359@opindex --recursive
360@cindex recursive search
361@cindex searching directory trees

--- 7 unchanged lines hidden (view full) ---

369Obsolete synonym for @samp{-i}.
370
371@item -U
372@itemx --binary
373@opindex -U
374@opindex --binary
375@cindex DOS/Windows binary files
376@cindex binary files, DOS/Windows
362Treat the file(s) as binary. By default, under MS-DOS
363and MS-Windows, @sc{grep} guesses the file type by looking
364at the contents of the first 32KB read from the file.
365If @sc{grep} decides the file is a text file, it strips the
366CR characters from the original file contents (to make
367regular expressions with @code{^} and @code{$} work correctly).
377Treat the file(s) as binary. By default, under @sc{ms-dos}
378and MS-Windows, @command{grep} guesses the file type by looking
379at the contents of the first 32kB read from the file.
380If @command{grep} decides the file is a text file, it strips the
381@code{CR} characters from the original file contents (to make
382regular expressions with @code{^} and @code{$} work correctly).
368Specifying @samp{-U} overrules this guesswork, causing all
383Specifying @samp{-U} overrules this guesswork, causing all
369files to be read and passed to the matching mechanism
370verbatim; if the file is a text file with CR/LF pairs
371at the end of each line, this will cause some regular
372expressions to fail. This option is only supported on
373MS-DOS and MS-Windows.
384files to be read and passed to the matching mechanism
385verbatim; if the file is a text file with @code{CR/LF} pairs
386at the end of each line, this will cause some regular
387expressions to fail. This option has no effect on platforms other than
388@sc{ms-dos} and MS-Windows.
374
375@item -u
376@itemx --unix-byte-offsets
377@opindex -u
378@opindex --unix-byte-offsets
379@cindex DOS byte offsets
380@cindex byte offsets, on DOS/Windows
389
390@item -u
391@itemx --unix-byte-offsets
392@opindex -u
393@opindex --unix-byte-offsets
394@cindex DOS byte offsets
395@cindex byte offsets, on DOS/Windows
381Report Unix-style byte offsets. This switch causes
382@sc{grep} to report byte offsets as if the file were Unix style
383text file, i.e. the byte offsets ignore the CR characters which were
384stripped off. This will produce results identical to running @sc{grep} on
385a Unix machine. This option has no effect unless @samp{-b}
386option is also used; it is only supported on MS-DOS and
396Report Unix-style byte offsets. This switch causes
397@command{grep} to report byte offsets as if the file were Unix style
398text file, i.e., the byte offsets ignore the @code{CR} characters which were
399stripped. This will produce results identical to running @command{grep} on
400a Unix machine. This option has no effect unless @samp{-b}
401option is also used; it has no effect on platforms other than @sc{ms-dos} and
387MS-Windows.
388
402MS-Windows.
403
404@item --mmap
405@opindex --mmap
406@cindex memory mapped input
407If possible, use the @code{mmap} system call to read input, instead of
408the default @code{read} system call. In some situations, @samp{--mmap}
409yields better performance. However, @samp{--mmap} can cause undefined
410behavior (including core dumps) if an input file shrinks while
411@command{grep} is operating, or if an I/O error occurs.
412
413@item -Z
414@itemx --null
415@opindex -Z
416@opindex --null
417@cindex zero-terminated file names
418Output a zero byte (the @sc{ascii} @code{NUL} character) instead of the
419character that normally follows a file name. For example, @samp{grep
420-lZ} outputs a zero byte after each file name instead of the usual
421newline. This option makes the output unambiguous, even in the presence
422of file names containing unusual characters like newlines. This option
423can be used with commands like @samp{find -print0}, @samp{perl -0},
424@samp{sort -z}, and @samp{xargs -0} to process arbitrary file names,
425even those that contain newline characters.
426
427@item -z
428@itemx --null-data
429@opindex -z
430@opindex --null-data
431@cindex zero-terminated lines
432Treat the input as a set of lines, each terminated by a zero byte (the
433@sc{ascii} @code{NUL} character) instead of a newline. Like the @samp{-Z}
434or @samp{--null} option, this option can be used with commands like
435@samp{sort -z} to process arbitrary file names.
436
389@end table
390
437@end table
438
391Several additional options control which variant of the @sc{grep}
439Several additional options control which variant of the @command{grep}
392matching engine is used. @xref{Grep Programs}.
393
440matching engine is used. @xref{Grep Programs}.
441
394@sc{grep} uses the environment variable @var{LANG} to
395provide internationalization support, if compiled with this feature.
442@section Environment Variables
396
443
397@node Diagnostics, Grep Programs, Invoking, Top
398@comment node-name, next, previous, up
444Grep's behavior is affected by the following environment variables.
445@cindex environment variables
446
447@table @code
448
449@item GREP_OPTIONS
450@vindex GREP_OPTIONS
451@cindex default options environment variable
452This variable specifies default options to be placed in front of any
453explicit options. For example, if @code{GREP_OPTIONS} is @samp{--text
454--directories=skip}, @command{grep} behaves as if the two options
455@samp{--text} and @samp{--directories=skip} had been specified before
456any explicit options. Option specifications are separated by
457whitespace. A backslash escapes the next character, so it can be used to
458specify an option containing whitespace or a backslash.
459
460@item LC_ALL
461@itemx LC_MESSAGES
462@itemx LANG
463@vindex LC_ALL
464@vindex LC_MESSAGES
465@vindex LANG
466@cindex language of messages
467@cindex message language
468@cindex national language support
469@cindex NLS
470@cindex translation of message language
471These variables specify the @code{LC_MESSAGES} locale, which determines
472the language that @command{grep} uses for messages. The locale is determined
473by the first of these variables that is set. American English is used
474if none of these environment variables are set, or if the message
475catalog is not installed, or if @command{grep} was not compiled with national
476language support (@sc{nls}).
477
478@item LC_ALL
479@itemx LC_CTYPE
480@itemx LANG
481@vindex LC_ALL
482@vindex LC_CTYPE
483@vindex LANG
484@cindex character type
485@cindex national language support
486@cindex NLS
487These variables specify the @code{LC_CTYPE} locale, which determines the
488type of characters, e.g., which characters are whitespace. The locale is
489determined by the first of these variables that is set. The @sc{posix}
490locale is used if none of these environment variables are set, or if the
491locale catalog is not installed, or if @command{grep} was not compiled with
492national language support (@sc{nls}).
493
494@item POSIXLY_CORRECT
495@vindex POSIXLY_CORRECT
496If set, @command{grep} behaves as @sc{posix.2} requires; otherwise,
497@command{grep} behaves more like other @sc{gnu} programs. @sc{posix.2}
498requires that options that
499follow file names must be treated as file names; by default, such
500options are permuted to the front of the operand list and are treated as
501options. Also, @sc{posix.2} requires that unrecognized options be
502diagnosed as
503``illegal'', but since they are not really against the law the default
504is to diagnose them as ``invalid''. @code{POSIXLY_CORRECT} also
505disables @code{_@var{N}_GNU_nonoption_argv_flags_}, described below.
506
507@item _@var{N}_GNU_nonoption_argv_flags_
508@vindex _@var{N}_GNU_nonoption_argv_flags_
509(Here @code{@var{N}} is @command{grep}'s numeric process ID.) If the
510@var{i}th character of this environment variable's value is @samp{1}, do
511not consider the @var{i}th operand of @command{grep} to be an option, even if
512it appears to be one. A shell can put this variable in the environment
513for each command it runs, specifying which operands are the results of
514file name wildcard expansion and therefore should not be treated as
515options. This behavior is available only with the @sc{gnu} C library, and
516only when @code{POSIXLY_CORRECT} is not set.
517
518@end table
519
520@node Diagnostics
399@chapter Diagnostics
521@chapter Diagnostics
522
400Normally, exit status is 0 if matches were found, and 1 if no matches
401were found (the @samp{-v} option inverts the sense of the exit status).
523Normally, exit status is 0 if matches were found, and 1 if no matches
524were found (the @samp{-v} option inverts the sense of the exit status).
402Exit status is 2 if there were syntax errors in the pattern,
525Exit status is 2 if there were syntax errors in the pattern,
403inaccessible input files, or other system errors.
404
526inaccessible input files, or other system errors.
527
405@node Grep Programs, Regular Expressions, Diagnostics, Top
406@comment node-name, next, previous, up
407@chapter @sc{grep} programs
528@node Grep Programs
529@chapter @command{grep} programs
408
530
409@sc{grep} searches the named input files (or standard input if no
531@command{grep} searches the named input files (or standard input if no
410files are named, or the file name @file{-} is given) for lines containing
532files are named, or the file name @file{-} is given) for lines containing
411a match to the given pattern. By default, @sc{grep} prints the matching lines.
412There are three major variants of @sc{grep}, controlled by the following options.
533a match to the given pattern. By default, @command{grep} prints the
534matching lines. There are three major variants of @command{grep},
535controlled by the following options.
413
414@table @samp
415
416@item -G
417@itemx --basic-regexp
418@opindex -G
419@opindex --basic-regexp
420@cindex matching basic regular expressions
536
537@table @samp
538
539@item -G
540@itemx --basic-regexp
541@opindex -G
542@opindex --basic-regexp
543@cindex matching basic regular expressions
421Interpret pattern as a basic regular expression. This is the default.
544Interpret pattern as a basic regular expression. This is the default.
422
423@item -E
545
546@item -E
424@item --extended-regexp
547@itemx --extended-regexp
425@opindex -E
426@opindex --extended-regexp
427@cindex matching extended regular expressions
548@opindex -E
549@opindex --extended-regexp
550@cindex matching extended regular expressions
428Interpret pattern as an extended regular expression.
551Interpret pattern as an extended regular expression.
429
430
431@item -F
432@itemx --fixed-strings
433@opindex -F
434@opindex --fixed-strings
435@cindex matching fixed strings
436Interpret pattern as a list of fixed strings, separated
437by newlines, any of which is to be matched.
438
439@end table
440
441In addition, two variant programs @sc{egrep} and @sc{fgrep} are available.
552
553
554@item -F
555@itemx --fixed-strings
556@opindex -F
557@opindex --fixed-strings
558@cindex matching fixed strings
559Interpret pattern as a list of fixed strings, separated
560by newlines, any of which is to be matched.
561
562@end table
563
564In addition, two variant programs @sc{egrep} and @sc{fgrep} are available.
442@sc{egrep} is similar (but not identical) to @samp{grep -E}, and
443is compatible with the historical Unix @sc{egrep}. @sc{fgrep} is the
565@sc{egrep} is the same as @samp{grep -E}. @sc{fgrep} is the
444same as @samp{grep -F}.
445
566same as @samp{grep -F}.
567
446@node Regular Expressions, Reporting Bugs, Grep Programs, Top
447@comment node-name, next, previous, up
568@node Regular Expressions
448@chapter Regular Expressions
449@cindex regular expressions
450
569@chapter Regular Expressions
570@cindex regular expressions
571
451A @dfn{regular expression} is a pattern that describes a set of strings.
572A @dfn{regular expression} is a pattern that describes a set of strings.
452Regular expressions are constructed analogously to arithmetic expressions,
573Regular expressions are constructed analogously to arithmetic expressions,
453by using various operators to combine smaller expressions.
454@sc{grep} understands two different versions of regular expression
455syntax: ``basic'' and ``extended''. In GNU @sc{grep}, there is no
456difference in available functionality using either syntax.
457In other implementations, basic regular expressions are less powerful.
458The following description applies to extended regular expressions;
574by using various operators to combine smaller expressions.
575@command{grep} understands two different versions of regular expression
576syntax: ``basic'' and ``extended''. In @sc{gnu} @command{grep}, there is no
577difference in available functionality using either syntax.
578In other implementations, basic regular expressions are less powerful.
579The following description applies to extended regular expressions;
459differences for basic regular expressions are summarized afterwards.
460
580differences for basic regular expressions are summarized afterwards.
581
461The fundamental building blocks are the regular expressions that match
582The fundamental building blocks are the regular expressions that match
462a single character. Most characters, including all letters and digits,
583a single character. Most characters, including all letters and digits,
463are regular expressions that match themselves. Any metacharacter
584are regular expressions that match themselves. Any metacharacter
464with special meaning may be quoted by preceding it with a backslash.
465A list of characters enclosed by @samp{[} and @samp{]} matches any
466single character in that list; if the first character of the list is the
585with special meaning may be quoted by preceding it with a backslash.
586A list of characters enclosed by @samp{[} and @samp{]} matches any
587single character in that list; if the first character of the list is the
467caret @samp{^}, then it
588caret @samp{^}, then it
468matches any character @strong{not} in the list. For example, the regular
469expression @samp{[0123456789]} matches any single digit.
589matches any character @strong{not} in the list. For example, the regular
590expression @samp{[0123456789]} matches any single digit.
470A range of @sc{ascii} characters may be specified by giving the first
471and last characters, separated by a hyphen. Finally, certain named
472classes of characters are predefined. Their names are self explanatory,
473and they are :
591A range of @sc{ascii} characters may be specified by giving the first
592and last characters, separated by a hyphen.
474
593
594Finally, certain named classes of characters are predefined, as follows.
595Their interpretation depends on the @code{LC_CTYPE} locale; the
596interpretation below is that of the @sc{posix} locale, which is the default
597if no @code{LC_CTYPE} locale is specified.
598
475@cindex classes of characters
476@cindex character classes
477@table @samp
478
479@item [:alnum:]
599@cindex classes of characters
600@cindex character classes
601@table @samp
602
603@item [:alnum:]
480@opindex alnum
481@cindex alphanumeric characters
482Any of [:digit:] or [:alpha:]
604@opindex alnum
605@cindex alphanumeric characters
606Any of @samp{[:digit:]} or @samp{[:alpha:]}
483
484@item [:alpha:]
485@opindex alpha
486@cindex alphabetic characters
607
608@item [:alpha:]
609@opindex alpha
610@cindex alphabetic characters
487Any local-specific or one of the @sc{ascii} letters:@*
611Any letter:@*
488@code{a b c d e f g h i j k l m n o p q r s t u v w x y z},@*
489@code{A B C D E F G H I J K L M N O P Q R S T U V W X Y Z}.
490
612@code{a b c d e f g h i j k l m n o p q r s t u v w x y z},@*
613@code{A B C D E F G H I J K L M N O P Q R S T U V W X Y Z}.
614
615@item [:blank:]
616@opindex blank
617@cindex blank characters
618Space or tab.
619
491@item [:cntrl:]
492@opindex cntrl
493@cindex control characters
620@item [:cntrl:]
621@opindex cntrl
622@cindex control characters
494Any of @code{BEL}, @code{BS}, @code{CR}, @code{FF}, @code{HT},
495@code{NL}, or @code{VT}.
623Any character with octal codes 000 through 037, or @code{DEL} (octal
624code 177).
496
497@item [:digit:]
498@opindex digit
499@cindex digit characters
500@cindex numeric characters
501Any one of @code{0 1 2 3 4 5 6 7 8 9}.
502
503@item [:graph:]
504@opindex graph
505@cindex graphic characters
625
626@item [:digit:]
627@opindex digit
628@cindex digit characters
629@cindex numeric characters
630Any one of @code{0 1 2 3 4 5 6 7 8 9}.
631
632@item [:graph:]
633@opindex graph
634@cindex graphic characters
506Anything that is not a @samp{[:alphanum:]} or @samp{[:punct:]}.
635Anything that is not a @samp{[:alnum:]} or @samp{[:punct:]}.
507
508@item [:lower:]
509@opindex lower
510@cindex lower-case alphabetic characters
511Any one of @code{a b c d e f g h i j k l m n o p q r s t u v w x y z}.
512
513@item [:print:]
514@opindex print
515@cindex printable characters
516Any character from the @samp{[:space:]} class, and any character that is
636
637@item [:lower:]
638@opindex lower
639@cindex lower-case alphabetic characters
640Any one of @code{a b c d e f g h i j k l m n o p q r s t u v w x y z}.
641
642@item [:print:]
643@opindex print
644@cindex printable characters
645Any character from the @samp{[:space:]} class, and any character that is
517@strong{not} in the @samp{[:isgraph:]} class.
646@strong{not} in the @samp{[:graph:]} class.
518
519@item [:punct:]
520@opindex punct
521@cindex punctuation characters
647
648@item [:punct:]
649@opindex punct
650@cindex punctuation characters
522Any one of @code{!@: " #% & ' ( ) ; < = > ?@: [ \ ] * + , - .@: / : ^ _ @{ | @}}.
651Any one of @code{!@: " # $ % & ' ( ) * + , - .@: / : ; < = > ?@: @@ [ \ ] ^ _ ` @{ | @} ~}.
523
652
524
525@item [:space:]
526@opindex space
527@cindex space characters
528@cindex whitespace characters
529Any one of @code{CR FF HT NL VT SPACE}.
530
531@item [:upper:]
532@opindex upper
533@cindex upper-case alphabetic characters
534Any one of @code{A B C D E F G H I J K L M N O P Q R S T U V W X Y Z}.
535
536@item [:xdigit:]
537@opindex xdigit
538@cindex xdigit class
539@cindex hexadecimal digits
540Any one of @code{a b c d e f A B C D E F 0 1 2 3 4 5 6 7 8 9}.
541
542@end table
543For example, @samp{[[:alnum:]]} means @samp{[0-9A-Za-z]}, except the latter
653@item [:space:]
654@opindex space
655@cindex space characters
656@cindex whitespace characters
657Any one of @code{CR FF HT NL VT SPACE}.
658
659@item [:upper:]
660@opindex upper
661@cindex upper-case alphabetic characters
662Any one of @code{A B C D E F G H I J K L M N O P Q R S T U V W X Y Z}.
663
664@item [:xdigit:]
665@opindex xdigit
666@cindex xdigit class
667@cindex hexadecimal digits
668Any one of @code{a b c d e f A B C D E F 0 1 2 3 4 5 6 7 8 9}.
669
670@end table
671For example, @samp{[[:alnum:]]} means @samp{[0-9A-Za-z]}, except the latter
544form is dependent upon the @sc{ascii} character encoding, whereas the
545former is portable. (Note that the brackets in these class names are
546part of the symbolic names, and must be included in addition to
547the brackets delimiting the bracket list). Most metacharacters lose
672form is dependent upon the @sc{ascii} character encoding, whereas the
673former is portable. (Note that the brackets in these class names are
674part of the symbolic names, and must be included in addition to
675the brackets delimiting the bracket list.) Most metacharacters lose
548their special meaning inside lists. To include a literal @samp{]}, place it
549first in the list. Similarly, to include a literal @samp{^}, place it anywhere
676their special meaning inside lists. To include a literal @samp{]}, place it
677first in the list. Similarly, to include a literal @samp{^}, place it anywhere
550but first. Finally, to include a literal @samp{-}, place it last.
678but first. Finally, to include a literal @samp{-}, place it last.
551
552The period @samp{.} matches any single character. The symbol @samp{\w}
553is a synonym for @samp{[[:alnum:]]} and @samp{\W} is a synonym for
554@samp{[^[:alnum]]}.
555
556The caret @samp{^} and the dollar sign @samp{$} are metacharacters that
557respectively match the empty string at the beginning and end
679
680The period @samp{.} matches any single character. The symbol @samp{\w}
681is a synonym for @samp{[[:alnum:]]} and @samp{\W} is a synonym for
682@samp{[^[:alnum]]}.
683
684The caret @samp{^} and the dollar sign @samp{$} are metacharacters that
685respectively match the empty string at the beginning and end
558of a line. The symbols @samp{\<} and @samp{\>} respectively match the
686of a line. The symbols @samp{\<} and @samp{\>} respectively match the
559empty string at the beginning and end of a word. The symbol
687empty string at the beginning and end of a word. The symbol
560@samp{\b} matches the empty string at the edge of a word, and @samp{\B}
561matches the empty string provided it's not at the edge of a word.
688@samp{\b} matches the empty string at the edge of a word, and @samp{\B}
689matches the empty string provided it's not at the edge of a word.
562
690
563A regular expression may be followed by one of several
691A regular expression may be followed by one of several
564repetition operators:
565
566
567@table @samp
568
569@item ?
570@opindex ?
571@cindex question mark
572@cindex match sub-expression at most once
573The preceding item is optional and will be matched at most once.
574
575@item *
576@opindex *
577@cindex asterisk
578@cindex match sub-expression zero or more times
579The preceding item will be matched zero or more times.
580
581@item +
582@opindex +
692repetition operators:
693
694
695@table @samp
696
697@item ?
698@opindex ?
699@cindex question mark
700@cindex match sub-expression at most once
701The preceding item is optional and will be matched at most once.
702
703@item *
704@opindex *
705@cindex asterisk
706@cindex match sub-expression zero or more times
707The preceding item will be matched zero or more times.
708
709@item +
710@opindex +
583@cindex plus sign
711@cindex plus sign
584The preceding item will be matched one or more times.
585
586@item @{@var{n}@}
587@opindex @{n@}
588@cindex braces, one argument
589@cindex match sub-expression n times
590The preceding item is matched exactly @var{n} times.
591
592@item @{@var{n},@}
593@opindex @{n,@}
594@cindex braces, second argument omitted
595@cindex match sub-expression n or more times
596The preceding item is matched n or more times.
597
712The preceding item will be matched one or more times.
713
714@item @{@var{n}@}
715@opindex @{n@}
716@cindex braces, one argument
717@cindex match sub-expression n times
718The preceding item is matched exactly @var{n} times.
719
720@item @{@var{n},@}
721@opindex @{n,@}
722@cindex braces, second argument omitted
723@cindex match sub-expression n or more times
724The preceding item is matched n or more times.
725
598@item @{,@var{m}@}
599@opindex @{,m@}
600@cindex braces, first argument omitted
601@cindex match sub-expression at most m times
602The preceding item is optional and is matched at most @var{m} times.
603
604@item @{@var{n},@var{m}@}
605@opindex @{n,m@}
606@cindex braces, two arguments
607The preceding item is matched at least @var{n} times, but not more than
608@var{m} times.
609
610@end table
611
726@item @{@var{n},@var{m}@}
727@opindex @{n,m@}
728@cindex braces, two arguments
729The preceding item is matched at least @var{n} times, but not more than
730@var{m} times.
731
732@end table
733
612Two regular expressions may be concatenated; the resulting regular
734Two regular expressions may be concatenated; the resulting regular
613expression matches any string formed by concatenating two substrings
735expression matches any string formed by concatenating two substrings
614that respectively match the concatenated subexpressions.
736that respectively match the concatenated subexpressions.
615
737
616Two regular expressions may be joined by the infix operator @samp{|}; the
617resulting regular expression matches any string matching either
738Two regular expressions may be joined by the infix operator @samp{|}; the
739resulting regular expression matches any string matching either
618subexpression.
619
740subexpression.
741
620Repetition takes precedence over concatenation, which in turn
742Repetition takes precedence over concatenation, which in turn
621takes precedence over alternation. A whole subexpression may be
743takes precedence over alternation. A whole subexpression may be
622enclosed in parentheses to override these precedence rules.
744enclosed in parentheses to override these precedence rules.
623
624The backreference @samp{\@var{n}}, where @var{n} is a single digit, matches the
625substring previously matched by the @var{n}th parenthesized subexpression
626of the regular expression.
627
628@cindex basic regular expressions
629In basic regular expressions the metacharacters @samp{?}, @samp{+},
630@samp{@{}, @samp{|}, @samp{(}, and @samp{)} lose their special meaning;
631instead use the backslashed versions @samp{\?}, @samp{\+}, @samp{\@{},
632@samp{\|}, @samp{\(}, and @samp{\)}.
633
745
746The backreference @samp{\@var{n}}, where @var{n} is a single digit, matches the
747substring previously matched by the @var{n}th parenthesized subexpression
748of the regular expression.
749
750@cindex basic regular expressions
751In basic regular expressions the metacharacters @samp{?}, @samp{+},
752@samp{@{}, @samp{|}, @samp{(}, and @samp{)} lose their special meaning;
753instead use the backslashed versions @samp{\?}, @samp{\+}, @samp{\@{},
754@samp{\|}, @samp{\(}, and @samp{\)}.
755
634In @sc{egrep} the metacharacter @samp{@{} loses its special meaning;
635instead use @samp{\@{}. This not true for @samp{grep -E}.
756@cindex interval specifications
757Traditional @command{egrep} did not support the @samp{@{} metacharacter,
758and some @command{egrep} implementations support @samp{\@{} instead, so
759portable scripts should avoid @samp{@{} in @samp{egrep} patterns and
760should use @samp{[@{]} to match a literal @samp{@{}.
636
761
762@sc{gnu} @command{egrep} attempts to support traditional usage by
763assuming that @samp{@{} is not special if it would be the start of an
764invalid interval specification. For example, the shell command
765@samp{egrep '@{1'} searches for the two-character string @samp{@{1}
766instead of reporting a syntax error in the regular expression.
767@sc{posix.2} allows this behavior as an extension, but portable scripts
768should avoid it.
637
769
638@node Reporting Bugs, Concept Index, Regular Expressions, Top
639@comment node-name, next, previous, up
770@node Usage
771@chapter Usage
772
773@cindex Usage, examples
774Here is an example shell command that invokes @sc{gnu} @command{grep}:
775
776@example
777grep -i 'hello.*world' menu.h main.c
778@end example
779
780@noindent
781This lists all lines in the files @file{menu.h} and @file{main.c} that
782contain the string @samp{hello} followed by the string @samp{world};
783this is because @samp{.*} matches zero or more characters within a line.
784@xref{Regular Expressions}. The @samp{-i} option causes @command{grep}
785to ignore case, causing it to match the line @samp{Hello, world!}, which
786it would not otherwise match. @xref{Invoking}, for more details about
787how to invoke @command{grep}.
788
789@cindex Using @command{grep}, Q&A
790@cindex FAQ about @command{grep} usage
791Here are some common questions and answers about @command{grep} usage.
792
793@enumerate
794
795@item
796How can I list just the names of matching files?
797
798@example
799grep -l 'main' *.c
800@end example
801
802@noindent
803lists the names of all C files in the current directory whose contents
804mention @samp{main}.
805
806@item
807How do I search directories recursively?
808
809@example
810grep -r 'hello' /home/gigi
811@end example
812
813@noindent
814searches for @samp{hello} in all files under the directory
815@file{/home/gigi}. For more control of which files are searched, use
816@command{find}, @command{grep} and @command{xargs}. For example,
817the following command searches only C files:
818
819@smallexample
820find /home/gigi -name '*.c' -print | xargs grep 'hello' /dev/null
821@end smallexample
822
823@item
824What if a pattern has a leading @samp{-}?
825
826@example
827grep -e '--cut here--' *
828@end example
829
830@noindent
831searches for all lines matching @samp{--cut here--}. Without @samp{-e},
832@command{grep} would attempt to parse @samp{--cut here--} as a list of
833options.
834
835@item
836Suppose I want to search for a whole word, not a part of a word?
837
838@example
839grep -w 'hello' *
840@end example
841
842@noindent
843searches only for instances of @samp{hello} that are entire words; it
844does not match @samp{Othello}. For more control, use @samp{\<} and
845@samp{\>} to match the start and end of words. For example:
846
847@example
848grep 'hello\>' *
849@end example
850
851@noindent
852searches only for words ending in @samp{hello}, so it matches the word
853@samp{Othello}.
854
855@item
856How do I output context around the matching lines?
857
858@example
859grep -C 2 'hello' *
860@end example
861
862@noindent
863prints two lines of context around each matching line.
864
865@item
866How do I force grep to print the name of the file?
867
868Append @file{/dev/null}:
869
870@example
871grep 'eli' /etc/passwd /dev/null
872@end example
873
874@item
875Why do people use strange regular expressions on @command{ps} output?
876
877@example
878ps -ef | grep '[c]ron'
879@end example
880
881If the pattern had been written without the square brackets, it would
882have matched not only the @command{ps} output line for @command{cron},
883but also the @command{ps} output line for @command{grep}.
884
885@item
886Why does @command{grep} report ``Binary file matches''?
887
888If @command{grep} listed all matching ``lines'' from a binary file, it
889would probably generate output that is not useful, and it might even
890muck up your display. So @sc{gnu} @command{grep} suppresses output from
891files that appear to be binary files. To force @sc{gnu} @command{grep}
892to output lines even from files that appear to be binary, use the
893@samp{-a} or @samp{--text} option.
894
895@item
896Why doesn't @samp{grep -lv} print nonmatching file names?
897
898@samp{grep -lv} lists the names of all files containing one or more
899lines that do not match. To list the names of all files that contain no
900matching lines, use the @samp{-L} or @samp{--files-without-match}
901option.
902
903@item
904I can do @sc{or} with @samp{|}, but what about @sc{and}?
905
906@example
907grep 'paul' /etc/motd | grep 'franc,ois'
908@end example
909
910@noindent
911finds all lines that contain both @samp{paul} and @samp{franc,ois}.
912
913@item
914How can I search in both standard input and in files?
915
916Use the special file name @samp{-}:
917
918@example
919cat /etc/passwd | grep 'alain' - /etc/motd
920@end example
921@end enumerate
922
923@node Reporting Bugs
640@chapter Reporting bugs
641
642@cindex Bugs, reporting
643Email bug reports to @email{bug-gnu-utils@@gnu.org}.
644Be sure to include the word ``grep'' somewhere in the ``Subject:'' field.
645
924@chapter Reporting bugs
925
926@cindex Bugs, reporting
927Email bug reports to @email{bug-gnu-utils@@gnu.org}.
928Be sure to include the word ``grep'' somewhere in the ``Subject:'' field.
929
646Large repetition counts in the @samp{@{m,n@}} construct may cause
647@sc{grep} to use lots of memory. In addition, certain other
648obscure regular expressions require exponential time and
930Large repetition counts in the @samp{@{m,n@}} construct may cause
931@command{grep} to use lots of memory. In addition, certain other
932obscure regular expressions require exponential time and
649space, and may cause grep to run out of memory.
933space, and may cause grep to run out of memory.
650Backreferences are very slow, and may require exponential time.
934Backreferences are very slow, and may require exponential time.
651
652@page
935
936@page
653@node Concept Index , Index, Reporting Bugs, Top
654@comment node-name, next, previous, up
937@node Concept Index
655@unnumbered Concept Index
656
657This is a general index of all issues discussed in this manual, with the
938@unnumbered Concept Index
939
940This is a general index of all issues discussed in this manual, with the
658exception of the @sc{grep} commands and command-line options.
941exception of the @command{grep} commands and command-line options.
659
660@printindex cp
661
662@page
942
943@printindex cp
944
945@page
663@node Index, , Concept Index, Top
946@node Index
664@unnumbered Index
665
947@unnumbered Index
948
666This is an alphabetical list of all @sc{grep} commands and command-line
667options.
949This is an alphabetical list of all @command{grep} commands, command-line
950options, and environment variables.
668
669@printindex fn
670
671@contents
672@bye
951
952@printindex fn
953
954@contents
955@bye