VirtualBox

source: kBuild/vendor/grep/2.12/doc/grep.info@ 3576

Last change on this file since 3576 was 2595, checked in by bird, 13 years ago

gnu grep version 2.12 (grep-2.12.tar.xz, md5sum=8d2f0346d08b13c18afb81f0e8aa1e2f)

File size: 104.8 KB
Line 
1This is grep.info, produced by makeinfo version 4.13 from grep.texi.
2
3This manual is for `grep', a pattern matching engine.
4
5 Copyright (C) 1999-2002, 2005, 2008-2012 Free Software Foundation,
6Inc.
7
8 Permission is granted to copy, distribute and/or modify this
9 document under the terms of the GNU Free Documentation License,
10 Version 1.3 or any later version published by the Free Software
11 Foundation; with no Invariant Sections, with no Front-Cover Texts,
12 and with no Back-Cover Texts. A copy of the license is included
13 in the section entitled "GNU Free Documentation License".
14
15INFO-DIR-SECTION Text creation and manipulation
16START-INFO-DIR-ENTRY
17* grep: (grep). Print lines matching a pattern.
18END-INFO-DIR-ENTRY
19
20
21File: grep.info, Node: Top, Next: Introduction, Up: (dir)
22
23grep
24****
25
26`grep' prints lines that contain a match for a pattern.
27
28 This manual is for version 2.12 of GNU Grep.
29
30 This manual is for `grep', a pattern matching engine.
31
32 Copyright (C) 1999-2002, 2005, 2008-2012 Free Software Foundation,
33Inc.
34
35 Permission is granted to copy, distribute and/or modify this
36 document under the terms of the GNU Free Documentation License,
37 Version 1.3 or any later version published by the Free Software
38 Foundation; with no Invariant Sections, with no Front-Cover Texts,
39 and with no Back-Cover Texts. A copy of the license is included
40 in the section entitled "GNU Free Documentation License".
41
42* Menu:
43
44* Introduction:: Introduction.
45* Invoking:: Command-line options, environment, exit status.
46* Regular Expressions:: Regular Expressions.
47* Usage:: Examples.
48* Reporting Bugs:: Reporting Bugs.
49* Copying:: License terms for this manual.
50* Index:: Combined index.
51
52
53File: grep.info, Node: Introduction, Next: Invoking, Prev: Top, Up: Top
54
551 Introduction
56**************
57
58`grep' searches input files for lines containing a match to a given
59pattern list. When it finds a match in a line, it copies the line to
60standard output (by default), or produces whatever other sort of output
61you have requested with options.
62
63 Though `grep' expects to do the matching on text, it has no limits
64on input line length other than available memory, and it can match
65arbitrary characters within a line. If the final byte of an input file
66is not a newline, `grep' silently supplies one. Since newline is also
67a separator for the list of patterns, there is no way to match newline
68characters in a text.
69
70
71File: grep.info, Node: Invoking, Next: Regular Expressions, Prev: Introduction, Up: Top
72
732 Invoking `grep'
74*****************
75
76The general synopsis of the `grep' command line is
77
78 grep OPTIONS PATTERN INPUT_FILE_NAMES
79
80There can be zero or more OPTIONS. PATTERN will only be seen as such
81(and not as an INPUT_FILE_NAME) if it wasn't already specified within
82OPTIONS (by using the `-e PATTERN' or `-f FILE' options). There can be
83zero or more INPUT_FILE_NAMES.
84
85* Menu:
86
87* Command-line Options:: Short and long names, grouped by category.
88* Environment Variables:: POSIX, GNU generic, and GNU grep specific.
89* Exit Status:: Exit status returned by `grep'.
90* grep Programs:: `grep' programs.
91
92
93File: grep.info, Node: Command-line Options, Next: Environment Variables, Up: Invoking
94
952.1 Command-line Options
96========================
97
98`grep' comes with a rich set of options: some from POSIX and some being
99GNU extensions. Long option names are always a GNU extension, even for
100options that are from POSIX specifications. Options that are specified
101by POSIX, under their short names, are explicitly marked as such to
102facilitate POSIX-portable programming. A few option names are provided
103for compatibility with older or more exotic implementations.
104
105* Menu:
106
107* Generic Program Information::
108* Matching Control::
109* General Output Control::
110* Output Line Prefix Control::
111* Context Line Control::
112* File and Directory Selection::
113* Other Options::
114
115 Several additional options control which variant of the `grep'
116matching engine is used. *Note grep Programs::.
117
118
119File: grep.info, Node: Generic Program Information, Next: Matching Control, Up: Command-line Options
120
1212.1.1 Generic Program Information
122---------------------------------
123
124`--help'
125 Print a usage message briefly summarizing the command-line options
126 and the bug-reporting address, then exit.
127
128`-V'
129`--version'
130 Print the version number of `grep' to the standard output stream.
131 This version number should be included in all bug reports.
132
133
134
135File: grep.info, Node: Matching Control, Next: General Output Control, Prev: Generic Program Information, Up: Command-line Options
136
1372.1.2 Matching Control
138----------------------
139
140`-e PATTERN'
141`--regexp=PATTERN'
142 Use PATTERN as the pattern. This can be used to specify multiple
143 search patterns, or to protect a pattern beginning with a `-'.
144 (`-e' is specified by POSIX.)
145
146`-f FILE'
147`--file=FILE'
148 Obtain patterns from FILE, one per line. The empty file contains
149 zero patterns, and therefore matches nothing. (`-f' is specified
150 by POSIX.)
151
152`-i'
153`-y'
154`--ignore-case'
155 Ignore case distinctions in both the pattern and the input files.
156 `-y' is an obsolete synonym that is provided for compatibility.
157 (`-i' is specified by POSIX.)
158
159`-v'
160`--invert-match'
161 Invert the sense of matching, to select non-matching lines. (`-v'
162 is specified by POSIX.)
163
164`-w'
165`--word-regexp'
166 Select only those lines containing matches that form whole words.
167 The test is that the matching substring must either be at the
168 beginning of the line, or preceded by a non-word constituent
169 character. Similarly, it must be either at the end of the line or
170 followed by a non-word constituent character. Word-constituent
171 characters are letters, digits, and the underscore.
172
173`-x'
174`--line-regexp'
175 Select only those matches that exactly match the whole line.
176 (`-x' is specified by POSIX.)
177
178
179
180File: grep.info, Node: General Output Control, Next: Output Line Prefix Control, Prev: Matching Control, Up: Command-line Options
181
1822.1.3 General Output Control
183----------------------------
184
185`-c'
186`--count'
187 Suppress normal output; instead print a count of matching lines
188 for each input file. With the `-v' (`--invert-match') option,
189 count non-matching lines. (`-c' is specified by POSIX.)
190
191`--color[=WHEN]'
192`--colour[=WHEN]'
193 Surround the matched (non-empty) strings, matching lines, context
194 lines, file names, line numbers, byte offsets, and separators (for
195 fields and groups of context lines) with escape sequences to
196 display them in color on the terminal. The colors are defined by
197 the environment variable `GREP_COLORS' and default to
198 `ms=01;31:mc=01;31:sl=:cx=:fn=35:ln=32:bn=32:se=36' for bold red
199 matched text, magenta file names, green line numbers, green byte
200 offsets, cyan separators, and default terminal colors otherwise.
201 The deprecated environment variable `GREP_COLOR' is still
202 supported, but its setting does not have priority; it defaults to
203 `01;31' (bold red) which only covers the color for matched text.
204 WHEN is `never', `always', or `auto'.
205
206`-L'
207`--files-without-match'
208 Suppress normal output; instead print the name of each input file
209 from which no output would normally have been printed. The
210 scanning of each file stops on the first match.
211
212`-l'
213`--files-with-matches'
214 Suppress normal output; instead print the name of each input file
215 from which output would normally have been printed. The scanning
216 of each file stops on the first match. (`-l' is specified by
217 POSIX.)
218
219`-m NUM'
220`--max-count=NUM'
221 Stop reading a file after NUM matching lines. If the input is
222 standard input from a regular file, and NUM matching lines are
223 output, `grep' ensures that the standard input is positioned just
224 after the last matching line before exiting, regardless of the
225 presence of trailing context lines. This enables a calling
226 process to resume a search. For example, the following shell
227 script makes use of it:
228
229 while grep -m 1 PATTERN
230 do
231 echo xxxx
232 done < FILE
233
234 But the following probably will not work because a pipe is not a
235 regular file:
236
237 # This probably will not work.
238 cat FILE |
239 while grep -m 1 PATTERN
240 do
241 echo xxxx
242 done
243
244 When `grep' stops after NUM matching lines, it outputs any
245 trailing context lines. Since context does not include matching
246 lines, `grep' will stop when it encounters another matching line.
247 When the `-c' or `--count' option is also used, `grep' does not
248 output a count greater than NUM. When the `-v' or
249 `--invert-match' option is also used, `grep' stops after
250 outputting NUM non-matching lines.
251
252`-o'
253`--only-matching'
254 Print only the matched (non-empty) parts of matching lines, with
255 each such part on a separate output line.
256
257`-q'
258`--quiet'
259`--silent'
260 Quiet; do not write anything to standard output. Exit immediately
261 with zero status if any match is found, even if an error was
262 detected. Also see the `-s' or `--no-messages' option. (`-q' is
263 specified by POSIX.)
264
265`-s'
266`--no-messages'
267 Suppress error messages about nonexistent or unreadable files.
268 Portability note: unlike GNU `grep', 7th Edition Unix `grep' did
269 not conform to POSIX, because it lacked `-q' and its `-s' option
270 behaved like GNU `grep''s `-q' option.(1) USG-style `grep' also
271 lacked `-q' but its `-s' option behaved like GNU `grep''s.
272 Portable shell scripts should avoid both `-q' and `-s' and should
273 redirect standard and error output to `/dev/null' instead. (`-s'
274 is specified by POSIX.)
275
276
277 ---------- Footnotes ----------
278
279 (1) Of course, 7th Edition Unix predated POSIX by several years!
280
281
282File: grep.info, Node: Output Line Prefix Control, Next: Context Line Control, Prev: General Output Control, Up: Command-line Options
283
2842.1.4 Output Line Prefix Control
285--------------------------------
286
287When several prefix fields are to be output, the order is always file
288name, line number, and byte offset, regardless of the order in which
289these options were specified.
290
291`-b'
292`--byte-offset'
293 Print the 0-based byte offset within the input file before each
294 line of output. If `-o' (`--only-matching') is specified, print
295 the offset of the matching part itself. When `grep' runs on
296 MS-DOS or MS-Windows, the printed byte offsets depend on whether
297 the `-u' (`--unix-byte-offsets') option is used; see below.
298
299`-H'
300`--with-filename'
301 Print the file name for each match. This is the default when
302 there is more than one file to search.
303
304`-h'
305`--no-filename'
306 Suppress the prefixing of file names on output. This is the
307 default when there is only one file (or only standard input) to
308 search.
309
310`--label=LABEL'
311 Display input actually coming from standard input as input coming
312 from file LABEL. This is especially useful when implementing
313 tools like `zgrep'; e.g.:
314
315 gzip -cd foo.gz | grep --label=foo -H something
316
317`-n'
318`--line-number'
319 Prefix each line of output with the 1-based line number within its
320 input file. (`-n' is specified by POSIX.)
321
322`-T'
323`--initial-tab'
324 Make sure that the first character of actual line content lies on
325 a tab stop, so that the alignment of tabs looks normal. This is
326 useful with options that prefix their output to the actual content:
327 `-H', `-n', and `-b'. In order to improve the probability that
328 lines from a single file will all start at the same column, this
329 also causes the line number and byte offset (if present) to be
330 printed in a minimum-size field width.
331
332`-u'
333`--unix-byte-offsets'
334 Report Unix-style byte offsets. This option causes `grep' to
335 report byte offsets as if the file were a Unix-style text file,
336 i.e., the byte offsets ignore the `CR' characters that were
337 stripped. This will produce results identical to running `grep'
338 on a Unix machine. This option has no effect unless the `-b'
339 option is also used; it has no effect on platforms other than
340 MS-DOS and MS-Windows.
341
342`-Z'
343`--null'
344 Output a zero byte (the ASCII `NUL' character) instead of the
345 character that normally follows a file name. For example, `grep
346 -lZ' outputs a zero byte after each file name instead of the usual
347 newline. This option makes the output unambiguous, even in the
348 presence of file names containing unusual characters like newlines.
349 This option can be used with commands like `find -print0', `perl
350 -0', `sort -z', and `xargs -0' to process arbitrary file names,
351 even those that contain newline characters.
352
353
354
355File: grep.info, Node: Context Line Control, Next: File and Directory Selection, Prev: Output Line Prefix Control, Up: Command-line Options
356
3572.1.5 Context Line Control
358--------------------------
359
360Regardless of how these options are set, `grep' will never print any
361given line more than once. If the `-o' (`--only-matching') option is
362specified, these options have no effect and a warning is given upon
363their use.
364
365`-A NUM'
366`--after-context=NUM'
367 Print NUM lines of trailing context after matching lines.
368
369`-B NUM'
370`--before-context=NUM'
371 Print NUM lines of leading context before matching lines.
372
373`-C NUM'
374`-NUM'
375`--context=NUM'
376 Print NUM lines of leading and trailing output context.
377
378`--group-separator=STRING'
379 When `-A', `-B' or `-C' are in use, print STRING instead of `--'
380 around disjoint groups of lines.
381
382`--no-group-separator'
383 When `-A', `-B' or `-C' are in use, print disjoint groups of lines
384 adjacent to each other.
385
386
387 Here are some points about how `grep' chooses the separator to print
388between prefix fields and line content:
389
390 * Matching lines normally use `:' as a separator between prefix
391 fields and actual line content.
392
393 * Context (i.e., non-matching) lines use `-' instead.
394
395 * When no context is specified, matching lines are simply output one
396 right after another.
397
398 * When nonzero context is specified, lines that are adjacent in the
399 input form a group and are output one right after another, while a
400 separator appears by default between disjoint groups on a line of
401 its own and without any prefix.
402
403 * The default separator is `--', however whether to include it and
404 its appearance can be changed with the options above.
405
406 * Each group may contain several matching lines when they are close
407 enough to each other that two otherwise adjacent but divided
408 groups connect and can just merge into a single contiguous one.
409
410
411File: grep.info, Node: File and Directory Selection, Next: Other Options, Prev: Context Line Control, Up: Command-line Options
412
4132.1.6 File and Directory Selection
414----------------------------------
415
416`-a'
417`--text'
418 Process a binary file as if it were text; this is equivalent to
419 the `--binary-files=text' option.
420
421`--binary-files=TYPE'
422 If the first few bytes of a file indicate that the file contains
423 binary data, assume that the file is of type TYPE. By default,
424 TYPE is `binary', and `grep' normally outputs either a one-line
425 message saying that a binary file matches, or no message if there
426 is no match.
427
428 If TYPE is `without-match', `grep' assumes that a binary file does
429 not match; this is equivalent to the `-I' option.
430
431 If TYPE is `text', `grep' processes a binary file as if it were
432 text; this is equivalent to the `-a' option.
433
434 _Warning:_ `--binary-files=text' might output binary garbage,
435 which can have nasty side effects if the output is a terminal and
436 if the terminal driver interprets some of it as commands.
437
438`-D ACTION'
439`--devices=ACTION'
440 If an input file is a device, FIFO, or socket, use ACTION to
441 process it. If ACTION is `read', all devices are read just as if
442 they were ordinary files. If ACTION is `skip', devices, FIFOs,
443 and sockets are silently skipped. By default, devices are read if
444 they are on the command line or if the `-R'
445 (`--dereference-recursive') option is used, and are skipped if
446 they are encountered recursively and the `-r' (`--recursive')
447 option is used. This option has no effect on a file that is read
448 via standard input.
449
450`-d ACTION'
451`--directories=ACTION'
452 If an input file is a directory, use ACTION to process it. By
453 default, ACTION is `read', which means that directories are read
454 just as if they were ordinary files (some operating systems and
455 file systems disallow this, and will cause `grep' to print error
456 messages for every directory or silently skip them). If ACTION is
457 `skip', directories are silently skipped. If ACTION is `recurse',
458 `grep' reads all files under each directory, recursively,
459 following command-line symbolic links and skipping other symlinks;
460 this is equivalent to the `-r' option.
461
462`--exclude=GLOB'
463 Skip files whose base name matches GLOB (using wildcard matching).
464 A file-name glob can use `*', `?', and `['...`]' as wildcards, and
465 `\' to quote a wildcard or backslash character literally.
466
467`--exclude-from=FILE'
468 Skip files whose base name matches any of the file-name globs read
469 from FILE (using wildcard matching as described under `--exclude').
470
471`--exclude-dir=DIR'
472 Exclude directories matching the pattern DIR from recursive
473 directory searches.
474
475`-I'
476 Process a binary file as if it did not contain matching data; this
477 is equivalent to the `--binary-files=without-match' option.
478
479`--include=GLOB'
480 Search only files whose base name matches GLOB (using wildcard
481 matching as described under `--exclude').
482
483`-r'
484`--recursive'
485 For each directory operand, read and process all files in that
486 directory, recursively. Follow symbolic links on the command
487 line, but skip symlinks that are encountered recursively. This is
488 the same as the `--directories=recurse' option.
489
490`-R'
491`--dereference-recursive'
492 For each directory operand, read and process all files in that
493 directory, recursively, following all symbolic links.
494
495
496
497File: grep.info, Node: Other Options, Prev: File and Directory Selection, Up: Command-line Options
498
4992.1.7 Other Options
500-------------------
501
502`--line-buffered'
503 Use line buffering on output. This can cause a performance
504 penalty.
505
506`--mmap'
507 This option is deprecated and now elicits a warning, but is
508 otherwise a no-op. It used to make `grep' read input with the
509 `mmap' system call, instead of the default `read' system call. On
510 modern systems, `mmap' would rarely if ever yield better
511 performance.
512
513`-U'
514`--binary'
515 Treat the file(s) as binary. By default, under MS-DOS and
516 MS-Windows, `grep' guesses the file type by looking at the
517 contents of the first 32kB read from the file. If `grep' decides
518 the file is a text file, it strips the `CR' characters from the
519 original file contents (to make regular expressions with `^' and
520 `$' work correctly). Specifying `-U' overrules this guesswork,
521 causing all files to be read and passed to the matching mechanism
522 verbatim; if the file is a text file with `CR/LF' pairs at the end
523 of each line, this will cause some regular expressions to fail.
524 This option has no effect on platforms other than MS-DOS and
525 MS-Windows.
526
527`-z'
528`--null-data'
529 Treat the input as a set of lines, each terminated by a zero byte
530 (the ASCII `NUL' character) instead of a newline. Like the `-Z'
531 or `--null' option, this option can be used with commands like
532 `sort -z' to process arbitrary file names.
533
534
535
536File: grep.info, Node: Environment Variables, Next: Exit Status, Prev: Command-line Options, Up: Invoking
537
5382.2 Environment Variables
539=========================
540
541The behavior of `grep' is affected by the following environment
542variables.
543
544 The locale for category `LC_FOO' is specified by examining the three
545environment variables `LC_ALL', `LC_FOO', and `LANG', in that order.
546The first of these variables that is set specifies the locale. For
547example, if `LC_ALL' is not set, but `LC_MESSAGES' is set to `pt_BR',
548then the Brazilian Portuguese locale is used for the `LC_MESSAGES'
549category. The `C' locale is used if none of these environment
550variables are set, if the locale catalog is not installed, or if `grep'
551was not compiled with national language support (NLS).
552
553 Many of the environment variables in the following list let you
554control highlighting using Select Graphic Rendition (SGR) commands
555interpreted by the terminal or terminal emulator. (See the section in
556the documentation of your text terminal for permitted values and their
557meanings as character attributes.) These substring values are integers
558in decimal representation and can be concatenated with semicolons.
559`grep' takes care of assembling the result into a complete SGR sequence
560(`\33['...`m'). Common values to concatenate include `1' for bold, `4'
561for underline, `5' for blink, `7' for inverse, `39' for default
562foreground color, `30' to `37' for foreground colors, `90' to `97' for
56316-color mode foreground colors, `38;5;0' to `38;5;255' for 88-color
564and 256-color modes foreground colors, `49' for default background
565color, `40' to `47' for background colors, `100' to `107' for 16-color
566mode background colors, and `48;5;0' to `48;5;255' for 88-color and
567256-color modes background colors.
568
569 The two-letter names used in the `GREP_COLORS' environment variable
570(and some of the others) refer to terminal "capabilities," the ability
571of a terminal to highlight text, or change its color, and so on. These
572capabilities are stored in an online database and accessed by the
573`terminfo' library.
574
575`GREP_OPTIONS'
576 This variable specifies default options to be placed in front of
577 any explicit options. For example, if `GREP_OPTIONS' is
578 `--binary-files=without-match --directories=skip', `grep' behaves
579 as if the two options `--binary-files=without-match' and
580 `--directories=skip' had been specified before any explicit
581 options. Option specifications are separated by whitespace. A
582 backslash escapes the next character, so it can be used to specify
583 an option containing whitespace or a backslash.
584
585 The `GREP_OPTIONS' value does not affect whether `grep' without
586 file operands searches standard input or the working directory;
587 that is affected only by command-line options. For example, the
588 command `grep PAT' searches standard input and the command `grep
589 -r PAT' searches the working directory, regardless of whether
590 `GREP_OPTIONS' contains `-r'.
591
592`GREP_COLOR'
593 This variable specifies the color used to highlight matched
594 (non-empty) text. It is deprecated in favor of `GREP_COLORS', but
595 still supported. The `mt', `ms', and `mc' capabilities of
596 `GREP_COLORS' have priority over it. It can only specify the
597 color used to highlight the matching non-empty text in any
598 matching line (a selected line when the `-v' command-line option
599 is omitted, or a context line when `-v' is specified). The
600 default is `01;31', which means a bold red foreground text on the
601 terminal's default background.
602
603`GREP_COLORS'
604 This variable specifies the colors and other attributes used to
605 highlight various parts of the output. Its value is a
606 colon-separated list of `terminfo' capabilities that defaults to
607 `ms=01;31:mc=01;31:sl=:cx=:fn=35:ln=32:bn=32:se=36' with the `rv'
608 and `ne' boolean capabilities omitted (i.e., false). Supported
609 capabilities are as follows.
610
611 `sl='
612 SGR substring for whole selected lines (i.e., matching lines
613 when the `-v' command-line option is omitted, or non-matching
614 lines when `-v' is specified). If however the boolean `rv'
615 capability and the `-v' command-line option are both
616 specified, it applies to context matching lines instead. The
617 default is empty (i.e., the terminal's default color pair).
618
619 `cx='
620 SGR substring for whole context lines (i.e., non-matching
621 lines when the `-v' command-line option is omitted, or
622 matching lines when `-v' is specified). If however the
623 boolean `rv' capability and the `-v' command-line option are
624 both specified, it applies to selected non-matching lines
625 instead. The default is empty (i.e., the terminal's default
626 color pair).
627
628 `rv'
629 Boolean value that reverses (swaps) the meanings of the `sl='
630 and `cx=' capabilities when the `-v' command-line option is
631 specified. The default is false (i.e., the capability is
632 omitted).
633
634 `mt=01;31'
635 SGR substring for matching non-empty text in any matching line
636 (i.e., a selected line when the `-v' command-line option is
637 omitted, or a context line when `-v' is specified). Setting
638 this is equivalent to setting both `ms=' and `mc=' at once to
639 the same value. The default is a bold red text foreground
640 over the current line background.
641
642 `ms=01;31'
643 SGR substring for matching non-empty text in a selected line.
644 (This is used only when the `-v' command-line option is
645 omitted.) The effect of the `sl=' (or `cx=' if `rv')
646 capability remains active when this takes effect. The
647 default is a bold red text foreground over the current line
648 background.
649
650 `mc=01;31'
651 SGR substring for matching non-empty text in a context line.
652 (This is used only when the `-v' command-line option is
653 specified.) The effect of the `cx=' (or `sl=' if `rv')
654 capability remains active when this takes effect. The
655 default is a bold red text foreground over the current line
656 background.
657
658 `fn=35'
659 SGR substring for file names prefixing any content line. The
660 default is a magenta text foreground over the terminal's
661 default background.
662
663 `ln=32'
664 SGR substring for line numbers prefixing any content line.
665 The default is a green text foreground over the terminal's
666 default background.
667
668 `bn=32'
669 SGR substring for byte offsets prefixing any content line.
670 The default is a green text foreground over the terminal's
671 default background.
672
673 `se=36'
674 SGR substring for separators that are inserted between
675 selected line fields (`:'), between context line fields (`-'),
676 and between groups of adjacent lines when nonzero context is
677 specified (`--'). The default is a cyan text foreground over
678 the terminal's default background.
679
680 `ne'
681 Boolean value that prevents clearing to the end of line using
682 Erase in Line (EL) to Right (`\33[K') each time a colorized
683 item ends. This is needed on terminals on which EL is not
684 supported. It is otherwise useful on terminals for which the
685 `back_color_erase' (`bce') boolean `terminfo' capability does
686 not apply, when the chosen highlight colors do not affect the
687 background, or when EL is too slow or causes too much flicker.
688 The default is false (i.e., the capability is omitted).
689
690 Note that boolean capabilities have no `='... part. They are
691 omitted (i.e., false) by default and become true when specified.
692
693`LC_ALL'
694`LC_COLLATE'
695`LANG'
696 These variables specify the locale for the `LC_COLLATE' category,
697 which determines the collating sequence used to interpret range
698 expressions like `[a-z]'.
699
700`LC_ALL'
701`LC_CTYPE'
702`LANG'
703 These variables specify the locale for the `LC_CTYPE' category,
704 which determines the type of characters, e.g., which characters
705 are whitespace.
706
707`LC_ALL'
708`LC_MESSAGES'
709`LANG'
710 These variables specify the locale for the `LC_MESSAGES' category,
711 which determines the language that `grep' uses for messages. The
712 default `C' locale uses American English messages.
713
714`POSIXLY_CORRECT'
715 If set, `grep' behaves as POSIX requires; otherwise, `grep'
716 behaves more like other GNU programs. POSIX requires that options
717 that follow file names must be treated as file names; by default,
718 such options are permuted to the front of the operand list and are
719 treated as options. Also, `POSIXLY_CORRECT' disables special
720 handling of an invalid bracket expression. *Note
721 invalid-bracket-expr::.
722
723`_N_GNU_nonoption_argv_flags_'
724 (Here `N' is `grep''s numeric process ID.) If the Ith character
725 of this environment variable's value is `1', do not consider the
726 Ith operand of `grep' to be an option, even if it appears to be
727 one. A shell can put this variable in the environment for each
728 command it runs, specifying which operands are the results of file
729 name wildcard expansion and therefore should not be treated as
730 options. This behavior is available only with the GNU C library,
731 and only when `POSIXLY_CORRECT' is not set.
732
733
734
735File: grep.info, Node: Exit Status, Next: grep Programs, Prev: Environment Variables, Up: Invoking
736
7372.3 Exit Status
738===============
739
740Normally, the exit status is 0 if selected lines are found and 1
741otherwise. But the exit status is 2 if an error occurred, unless the
742`-q' or `--quiet' or `--silent' option is used and a selected line is
743found. Note, however, that POSIX only mandates, for programs such as
744`grep', `cmp', and `diff', that the exit status in case of error be
745greater than 1; it is therefore advisable, for the sake of portability,
746to use logic that tests for this general condition instead of strict
747equality with 2.
748
749
750File: grep.info, Node: grep Programs, Prev: Exit Status, Up: Invoking
751
7522.4 `grep' Programs
753===================
754
755`grep' searches the named input files for lines containing a match to
756the given pattern. By default, `grep' prints the matching lines. A
757file named `-' stands for standard input. If no input is specified,
758`grep' searches the working directory `.' if given a command-line
759option specifying recursion; otherwise, `grep' searches standard input.
760There are four major variants of `grep', controlled by the following
761options.
762
763`-G'
764`--basic-regexp'
765 Interpret the pattern as a basic regular expression (BRE). This
766 is the default.
767
768`-E'
769`--extended-regexp'
770 Interpret the pattern as an extended regular expression (ERE).
771 (`-E' is specified by POSIX.)
772
773`-F'
774`--fixed-strings'
775 Interpret the pattern as a list of fixed strings, separated by
776 newlines, any of which is to be matched. (`-F' is specified by
777 POSIX.)
778
779`-P'
780`--perl-regexp'
781 Interpret the pattern as a Perl regular expression. This is
782 highly experimental and `grep -P' may warn of unimplemented
783 features.
784
785
786 In addition, two variant programs `egrep' and `fgrep' are available.
787`egrep' is the same as `grep -E'. `fgrep' is the same as `grep -F'.
788Direct invocation as either `egrep' or `fgrep' is deprecated, but is
789provided to allow historical applications that rely on them to run
790unmodified.
791
792
793File: grep.info, Node: Regular Expressions, Next: Usage, Prev: Invoking, Up: Top
794
7953 Regular Expressions
796*********************
797
798A "regular expression" is a pattern that describes a set of strings.
799Regular expressions are constructed analogously to arithmetic
800expressions, by using various operators to combine smaller expressions.
801`grep' understands three different versions of regular expression
802syntax: "basic," (BRE) "extended" (ERE) and "perl". In GNU `grep',
803there is no difference in available functionality between the basic and
804extended syntaxes. In other implementations, basic regular expressions
805are less powerful. The following description applies to extended
806regular expressions; differences for basic regular expressions are
807summarized afterwards. Perl regular expressions give additional
808functionality, and are documented in the pcresyntax(3) and
809pcrepattern(3) manual pages, but may not be available on every system.
810
811* Menu:
812
813* Fundamental Structure::
814* Character Classes and Bracket Expressions::
815* The Backslash Character and Special Expressions::
816* Anchoring::
817* Back-references and Subexpressions::
818* Basic vs Extended::
819
820
821File: grep.info, Node: Fundamental Structure, Next: Character Classes and Bracket Expressions, Up: Regular Expressions
822
8233.1 Fundamental Structure
824=========================
825
826The fundamental building blocks are the regular expressions that match
827a single character. Most characters, including all letters and digits,
828are regular expressions that match themselves. Any meta-character with
829special meaning may be quoted by preceding it with a backslash.
830
831 A regular expression may be followed by one of several repetition
832operators:
833
834`.'
835 The period `.' matches any single character.
836
837`?'
838 The preceding item is optional and will be matched at most once.
839
840`*'
841 The preceding item will be matched zero or more times.
842
843`+'
844 The preceding item will be matched one or more times.
845
846`{N}'
847 The preceding item is matched exactly N times.
848
849`{N,}'
850 The preceding item is matched N or more times.
851
852`{,M}'
853 The preceding item is matched at most M times.
854
855`{N,M}'
856 The preceding item is matched at least N times, but not more than
857 M times.
858
859
860 The empty regular expression matches the empty string. Two regular
861expressions may be concatenated; the resulting regular expression
862matches any string formed by concatenating two substrings that
863respectively match the concatenated expressions.
864
865 Two regular expressions may be joined by the infix operator `|'; the
866resulting regular expression matches any string matching either
867alternate expression.
868
869 Repetition takes precedence over concatenation, which in turn takes
870precedence over alternation. A whole expression may be enclosed in
871parentheses to override these precedence rules and form a subexpression.
872
873
874File: grep.info, Node: Character Classes and Bracket Expressions, Next: The Backslash Character and Special Expressions, Prev: Fundamental Structure, Up: Regular Expressions
875
8763.2 Character Classes and Bracket Expressions
877=============================================
878
879A "bracket expression" is a list of characters enclosed by `[' and `]'.
880It matches any single character in that list; if the first character of
881the list is the caret `^', then it matches any character *not* in the
882list. For example, the regular expression `[0123456789]' matches any
883single digit.
884
885 Within a bracket expression, a "range expression" consists of two
886characters separated by a hyphen. It matches any single character that
887sorts between the two characters, inclusive, using the locale's
888collating sequence and character set. For example, in the default C
889locale, `[a-d]' is equivalent to `[abcd]'. Many locales sort
890characters in dictionary order, and in these locales `[a-d]' is
891typically not equivalent to `[abcd]'; it might be equivalent to
892`[aBbCcDd]', for example. To obtain the traditional interpretation of
893bracket expressions, you can use the `C' locale by setting the `LC_ALL'
894environment variable to the value `C'.
895
896 Finally, certain named classes of characters are predefined within
897bracket expressions, as follows. Their interpretation depends on the
898`LC_CTYPE' locale; for example, `[[:alnum:]]' means the character class
899of numbers and letters in the current locale.
900
901`[:alnum:]'
902 Alphanumeric characters: `[:alpha:]' and `[:digit:]'; in the `C'
903 locale and ASCII character encoding, this is the same as
904 `[0-9A-Za-z]'.
905
906`[:alpha:]'
907 Alphabetic characters: `[:lower:]' and `[:upper:]'; in the `C'
908 locale and ASCII character encoding, this is the same as
909 `[A-Za-z]'.
910
911`[:blank:]'
912 Blank characters: space and tab.
913
914`[:cntrl:]'
915 Control characters. In ASCII, these characters have octal codes
916 000 through 037, and 177 (`DEL'). In other character sets, these
917 are the equivalent characters, if any.
918
919`[:digit:]'
920 Digits: `0 1 2 3 4 5 6 7 8 9'.
921
922`[:graph:]'
923 Graphical characters: `[:alnum:]' and `[:punct:]'.
924
925`[:lower:]'
926 Lower-case letters; in the `C' locale and ASCII character
927 encoding, this is `a b c d e f g h i j k l m n o p q r s t u v w x
928 y z'.
929
930`[:print:]'
931 Printable characters: `[:alnum:]', `[:punct:]', and space.
932
933`[:punct:]'
934 Punctuation characters; in the `C' locale and ASCII character
935 encoding, this is `! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \
936 ] ^ _ ` { | } ~'.
937
938`[:space:]'
939 Space characters: in the `C' locale, this is tab, newline,
940 vertical tab, form feed, carriage return, and space. *Note
941 Usage::, for more discussion of matching newlines.
942
943`[:upper:]'
944 Upper-case letters: in the `C' locale and ASCII character
945 encoding, this is `A B C D E F G H I J K L M N O P Q R S T U V W X
946 Y Z'.
947
948`[:xdigit:]'
949 Hexadecimal digits: `0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f'.
950
951 Note that the brackets in these class names are part of the symbolic
952names, and must be included in addition to the brackets delimiting the
953bracket expression.
954
955 If you mistakenly omit the outer brackets, and search for say,
956`[:upper:]', GNU `grep' prints a diagnostic and exits with status 2, on
957the assumption that you did not intend to search for the nominally
958equivalent regular expression: `[:epru]'. Set the `POSIXLY_CORRECT'
959environment variable to disable this feature.
960
961 Most meta-characters lose their special meaning inside bracket
962expressions.
963
964`]'
965 ends the bracket expression if it's not the first list item. So,
966 if you want to make the `]' character a list item, you must put it
967 first.
968
969`[.'
970 represents the open collating symbol.
971
972`.]'
973 represents the close collating symbol.
974
975`[='
976 represents the open equivalence class.
977
978`=]'
979 represents the close equivalence class.
980
981`[:'
982 represents the open character class symbol, and should be followed
983 by a valid character class name.
984
985`:]'
986 represents the close character class symbol.
987
988`-'
989 represents the range if it's not first or last in a list or the
990 ending point of a range.
991
992`^'
993 represents the characters not in the list. If you want to make
994 the `^' character a list item, place it anywhere but first.
995
996
997
998File: grep.info, Node: The Backslash Character and Special Expressions, Next: Anchoring, Prev: Character Classes and Bracket Expressions, Up: Regular Expressions
999
10003.3 The Backslash Character and Special Expressions
1001===================================================
1002
1003The `\' character, when followed by certain ordinary characters, takes
1004a special meaning:
1005
1006`\b'
1007 Match the empty string at the edge of a word.
1008
1009`\B'
1010 Match the empty string provided it's not at the edge of a word.
1011
1012`\<'
1013 Match the empty string at the beginning of word.
1014
1015`\>'
1016 Match the empty string at the end of word.
1017
1018`\w'
1019 Match word constituent, it is a synonym for `[_[:alnum:]]'.
1020
1021`\W'
1022 Match non-word constituent, it is a synonym for `[^_[:alnum:]]'.
1023
1024`\s'
1025 Match whitespace, it is a synonym for `[[:space:]]'.
1026
1027`\S'
1028 Match non-whitespace, it is a synonym for `[^[:space:]]'.
1029
1030
1031 For example, `\brat\b' matches the separate word `rat', `\Brat\B'
1032matches `crate' but not `furry rat'.
1033
1034
1035File: grep.info, Node: Anchoring, Next: Back-references and Subexpressions, Prev: The Backslash Character and Special Expressions, Up: Regular Expressions
1036
10373.4 Anchoring
1038=============
1039
1040The caret `^' and the dollar sign `$' are meta-characters that
1041respectively match the empty string at the beginning and end of a line.
1042They are termed "anchors", since they force the match to be "anchored"
1043to beginning or end of a line, respectively.
1044
1045
1046File: grep.info, Node: Back-references and Subexpressions, Next: Basic vs Extended, Prev: Anchoring, Up: Regular Expressions
1047
10483.5 Back-references and Subexpressions
1049======================================
1050
1051The back-reference `\N', where N is a single digit, matches the
1052substring previously matched by the Nth parenthesized subexpression of
1053the regular expression. For example, `(a)\1' matches `aa'. When used
1054with alternation, if the group does not participate in the match then
1055the back-reference makes the whole match fail. For example, `a(.)|b\1'
1056will not match `ba'. When multiple regular expressions are given with
1057`-e' or from a file (`-f FILE'), back-references are local to each
1058expression.
1059
1060
1061File: grep.info, Node: Basic vs Extended, Prev: Back-references and Subexpressions, Up: Regular Expressions
1062
10633.6 Basic vs Extended Regular Expressions
1064=========================================
1065
1066In basic regular expressions the meta-characters `?', `+', `{', `|',
1067`(', and `)' lose their special meaning; instead use the backslashed
1068versions `\?', `\+', `\{', `\|', `\(', and `\)'.
1069
1070 Traditional `egrep' did not support the `{' meta-character, and some
1071`egrep' implementations support `\{' instead, so portable scripts
1072should avoid `{' in `grep -E' patterns and should use `[{]' to match a
1073literal `{'.
1074
1075 GNU `grep -E' attempts to support traditional usage by assuming that
1076`{' is not special if it would be the start of an invalid interval
1077specification. For example, the command `grep -E '{1'' searches for
1078the two-character string `{1' instead of reporting a syntax error in
1079the regular expression. POSIX allows this behavior as an extension,
1080but portable scripts should avoid it.
1081
1082
1083File: grep.info, Node: Usage, Next: Reporting Bugs, Prev: Regular Expressions, Up: Top
1084
10854 Usage
1086*******
1087
1088Here is an example command that invokes GNU `grep':
1089
1090 grep -i 'hello.*world' menu.h main.c
1091
1092This lists all lines in the files `menu.h' and `main.c' that contain
1093the string `hello' followed by the string `world'; this is because `.*'
1094matches zero or more characters within a line. *Note Regular
1095Expressions::. The `-i' option causes `grep' to ignore case, causing
1096it to match the line `Hello, world!', which it would not otherwise
1097match. *Note Invoking::, for more details about how to invoke `grep'.
1098
1099 Here are some common questions and answers about `grep' usage.
1100
1101 1. How can I list just the names of matching files?
1102
1103 grep -l 'main' *.c
1104
1105 lists the names of all C files in the current directory whose
1106 contents mention `main'.
1107
1108 2. How do I search directories recursively?
1109
1110 grep -r 'hello' /home/gigi
1111
1112 searches for `hello' in all files under the `/home/gigi' directory.
1113 For more control over which files are searched, use `find',
1114 `grep', and `xargs'. For example, the following command searches
1115 only C files:
1116
1117 find /home/gigi -name '*.c' -print0 | xargs -0r grep -H 'hello'
1118
1119 This differs from the command:
1120
1121 grep -H 'hello' *.c
1122
1123 which merely looks for `hello' in all files in the current
1124 directory whose names end in `.c'. The `find ...' command line
1125 above is more similar to the command:
1126
1127 grep -rH --include='*.c' 'hello' /home/gigi
1128
1129 3. What if a pattern has a leading `-'?
1130
1131 grep -e '--cut here--' *
1132
1133 searches for all lines matching `--cut here--'. Without `-e',
1134 `grep' would attempt to parse `--cut here--' as a list of options.
1135
1136 4. Suppose I want to search for a whole word, not a part of a word?
1137
1138 grep -w 'hello' *
1139
1140 searches only for instances of `hello' that are entire words; it
1141 does not match `Othello'. For more control, use `\<' and `\>' to
1142 match the start and end of words. For example:
1143
1144 grep 'hello\>' *
1145
1146 searches only for words ending in `hello', so it matches the word
1147 `Othello'.
1148
1149 5. How do I output context around the matching lines?
1150
1151 grep -C 2 'hello' *
1152
1153 prints two lines of context around each matching line.
1154
1155 6. How do I force `grep' to print the name of the file?
1156
1157 Append `/dev/null':
1158
1159 grep 'eli' /etc/passwd /dev/null
1160
1161 gets you:
1162
1163 /etc/passwd:eli:x:2098:1000:Eli Smith:/home/eli:/bin/bash
1164
1165 Alternatively, use `-H', which is a GNU extension:
1166
1167 grep -H 'eli' /etc/passwd
1168
1169 7. Why do people use strange regular expressions on `ps' output?
1170
1171 ps -ef | grep '[c]ron'
1172
1173 If the pattern had been written without the square brackets, it
1174 would have matched not only the `ps' output line for `cron', but
1175 also the `ps' output line for `grep'. Note that on some platforms,
1176 `ps' limits the output to the width of the screen; `grep' does not
1177 have any limit on the length of a line except the available memory.
1178
1179 8. Why does `grep' report "Binary file matches"?
1180
1181 If `grep' listed all matching "lines" from a binary file, it would
1182 probably generate output that is not useful, and it might even
1183 muck up your display. So GNU `grep' suppresses output from files
1184 that appear to be binary files. To force GNU `grep' to output
1185 lines even from files that appear to be binary, use the `-a' or
1186 `--binary-files=text' option. To eliminate the "Binary file
1187 matches" messages, use the `-I' or `--binary-files=without-match'
1188 option.
1189
1190 9. Why doesn't `grep -lv' print non-matching file names?
1191
1192 `grep -lv' lists the names of all files containing one or more
1193 lines that do not match. To list the names of all files that
1194 contain no matching lines, use the `-L' or `--files-without-match'
1195 option.
1196
1197 10. I can do "OR" with `|', but what about "AND"?
1198
1199 grep 'paul' /etc/motd | grep 'franc,ois'
1200
1201 finds all lines that contain both `paul' and `franc,ois'.
1202
1203 11. Why does the empty pattern match every input line?
1204
1205 The `grep' command searches for lines that contain strings that
1206 match a pattern. Every line contains the empty string, so an
1207 empty pattern causes `grep' to find a match on each line. It is
1208 not the only such pattern: `^', `$', `.*', and many other patterns
1209 cause `grep' to match every line.
1210
1211 To match empty lines, use the pattern `^$'. To match blank lines,
1212 use the pattern `^[[:blank:]]*$'. To match no lines at all, use
1213 the command `grep -f /dev/null'.
1214
1215 12. How can I search in both standard input and in files?
1216
1217 Use the special file name `-':
1218
1219 cat /etc/passwd | grep 'alain' - /etc/motd
1220
1221 13. How to express palindromes in a regular expression?
1222
1223 It can be done by using back-references; for example, a palindrome
1224 of 4 characters can be written with a BRE:
1225
1226 grep -w -e '\(.\)\(.\).\2\1' file
1227
1228 It matches the word "radar" or "civic."
1229
1230 Guglielmo Bondioni proposed a single RE that finds all palindromes
1231 up to 19 characters long using 9 subexpressions and
1232 9 back-references:
1233
1234 grep -E -e '^(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?).?\9\8\7\6\5\4\3\2\1$' file
1235
1236 Note this is done by using GNU ERE extensions; it might not be
1237 portable to other implementations of `grep'.
1238
1239 14. Why is this back-reference failing?
1240
1241 echo 'ba' | grep -E '(a)\1|b\1'
1242
1243 This gives no output, because the first alternate `(a)\1' does not
1244 match, as there is no `aa' in the input, so the `\1' in the second
1245 alternate has nothing to refer back to, meaning it will never
1246 match anything. (The second alternate in this example can only
1247 match if the first alternate has matched--making the second one
1248 superfluous.)
1249
1250 15. How can I match across lines?
1251
1252 Standard grep cannot do this, as it is fundamentally line-based.
1253 Therefore, merely using the `[:space:]' character class does not
1254 match newlines in the way you might expect. However, if your grep
1255 is compiled with Perl patterns enabled, the Perl `s' modifier
1256 (which makes `.' match newlines) can be used:
1257
1258 printf 'foo\nbar\n' | grep -P '(?s)foo.*?bar'
1259
1260 With the GNU `grep' option `-z' (*note File and Directory
1261 Selection::), the input is terminated by null bytes. Thus, you
1262 can match newlines in the input, but the output will be the whole
1263 file, so this is really only useful to determine if the pattern is
1264 present:
1265
1266 printf 'foo\nbar\n' | grep -z -q 'foo[[:space:]]\+bar'
1267
1268 Failing either of those options, you need to transform the input
1269 before giving it to `grep', or turn to `awk', `sed', `perl', or
1270 many other utilities that are designed to operate across lines.
1271
1272 16. What do `grep', `fgrep', and `egrep' stand for?
1273
1274 The name `grep' comes from the way line editing was done on Unix.
1275 For example, `ed' uses the following syntax to print a list of
1276 matching lines on the screen:
1277
1278 global/regular expression/print
1279 g/re/p
1280
1281 `fgrep' stands for Fixed `grep'; `egrep' stands for Extended
1282 `grep'.
1283
1284
1285
1286File: grep.info, Node: Reporting Bugs, Next: Copying, Prev: Usage, Up: Top
1287
12885 Reporting bugs
1289****************
1290
1291Email bug reports to <[email protected]>, a mailing list whose web page
1292is `http://lists.gnu.org/mailman/listinfo/bug-grep'. The Savannah bug
1293tracker for `grep' is located at
1294`http://savannah.gnu.org/bugs/?group=grep'.
1295
12965.1 Known Bugs
1297==============
1298
1299Large repetition counts in the `{n,m}' construct may cause `grep' to
1300use lots of memory. In addition, certain other obscure regular
1301expressions require exponential time and space, and may cause `grep' to
1302run out of memory.
1303
1304 Back-references are very slow, and may require exponential time.
1305
1306
1307File: grep.info, Node: Copying, Next: Index, Prev: Reporting Bugs, Up: Top
1308
13096 Copying
1310*********
1311
1312GNU `grep' is licensed under the GNU GPL, which makes it "free
1313software".
1314
1315 The "free" in "free software" refers to liberty, not price. As some
1316GNU project advocates like to point out, think of "free speech" rather
1317than "free beer". In short, you have the right (freedom) to run and
1318change `grep' and distribute it to other people, and--if you
1319want--charge money for doing either. The important restriction is that
1320you have to grant your recipients the same rights and impose the same
1321restrictions.
1322
1323 This general method of licensing software is sometimes called "open
1324source". The GNU project prefers the term "free software" for reasons
1325outlined at
1326`http://www.gnu.org/philosophy/open-source-misses-the-point.html'.
1327
1328 This manual is free documentation in the same sense. The
1329documentation license is included below. The license for the program
1330is available with the source code, or at
1331`http://www.gnu.org/licenses/gpl.html'.
1332
1333* Menu:
1334
1335* GNU Free Documentation License::
1336
1337
1338File: grep.info, Node: GNU Free Documentation License, Up: Copying
1339
13406.1 GNU Free Documentation License
1341==================================
1342
1343 Version 1.3, 3 November 2008
1344
1345 Copyright (C) 2000-2002, 2007-2008, 2010-2012 Free Software
1346 Foundation, Inc.
1347 `http://fsf.org/'
1348
1349 Everyone is permitted to copy and distribute verbatim copies
1350 of this license document, but changing it is not allowed.
1351
1352 0. PREAMBLE
1353
1354 The purpose of this License is to make a manual, textbook, or other
1355 functional and useful document "free" in the sense of freedom: to
1356 assure everyone the effective freedom to copy and redistribute it,
1357 with or without modifying it, either commercially or
1358 noncommercially. Secondarily, this License preserves for the
1359 author and publisher a way to get credit for their work, while not
1360 being considered responsible for modifications made by others.
1361
1362 This License is a kind of "copyleft", which means that derivative
1363 works of the document must themselves be free in the same sense.
1364 It complements the GNU General Public License, which is a copyleft
1365 license designed for free software.
1366
1367 We have designed this License in order to use it for manuals for
1368 free software, because free software needs free documentation: a
1369 free program should come with manuals providing the same freedoms
1370 that the software does. But this License is not limited to
1371 software manuals; it can be used for any textual work, regardless
1372 of subject matter or whether it is published as a printed book.
1373 We recommend this License principally for works whose purpose is
1374 instruction or reference.
1375
1376 1. APPLICABILITY AND DEFINITIONS
1377
1378 This License applies to any manual or other work, in any medium,
1379 that contains a notice placed by the copyright holder saying it
1380 can be distributed under the terms of this License. Such a notice
1381 grants a world-wide, royalty-free license, unlimited in duration,
1382 to use that work under the conditions stated herein. The
1383 "Document", below, refers to any such manual or work. Any member
1384 of the public is a licensee, and is addressed as "you". You
1385 accept the license if you copy, modify or distribute the work in a
1386 way requiring permission under copyright law.
1387
1388 A "Modified Version" of the Document means any work containing the
1389 Document or a portion of it, either copied verbatim, or with
1390 modifications and/or translated into another language.
1391
1392 A "Secondary Section" is a named appendix or a front-matter section
1393 of the Document that deals exclusively with the relationship of the
1394 publishers or authors of the Document to the Document's overall
1395 subject (or to related matters) and contains nothing that could
1396 fall directly within that overall subject. (Thus, if the Document
1397 is in part a textbook of mathematics, a Secondary Section may not
1398 explain any mathematics.) The relationship could be a matter of
1399 historical connection with the subject or with related matters, or
1400 of legal, commercial, philosophical, ethical or political position
1401 regarding them.
1402
1403 The "Invariant Sections" are certain Secondary Sections whose
1404 titles are designated, as being those of Invariant Sections, in
1405 the notice that says that the Document is released under this
1406 License. If a section does not fit the above definition of
1407 Secondary then it is not allowed to be designated as Invariant.
1408 The Document may contain zero Invariant Sections. If the Document
1409 does not identify any Invariant Sections then there are none.
1410
1411 The "Cover Texts" are certain short passages of text that are
1412 listed, as Front-Cover Texts or Back-Cover Texts, in the notice
1413 that says that the Document is released under this License. A
1414 Front-Cover Text may be at most 5 words, and a Back-Cover Text may
1415 be at most 25 words.
1416
1417 A "Transparent" copy of the Document means a machine-readable copy,
1418 represented in a format whose specification is available to the
1419 general public, that is suitable for revising the document
1420 straightforwardly with generic text editors or (for images
1421 composed of pixels) generic paint programs or (for drawings) some
1422 widely available drawing editor, and that is suitable for input to
1423 text formatters or for automatic translation to a variety of
1424 formats suitable for input to text formatters. A copy made in an
1425 otherwise Transparent file format whose markup, or absence of
1426 markup, has been arranged to thwart or discourage subsequent
1427 modification by readers is not Transparent. An image format is
1428 not Transparent if used for any substantial amount of text. A
1429 copy that is not "Transparent" is called "Opaque".
1430
1431 Examples of suitable formats for Transparent copies include plain
1432 ASCII without markup, Texinfo input format, LaTeX input format,
1433 SGML or XML using a publicly available DTD, and
1434 standard-conforming simple HTML, PostScript or PDF designed for
1435 human modification. Examples of transparent image formats include
1436 PNG, XCF and JPG. Opaque formats include proprietary formats that
1437 can be read and edited only by proprietary word processors, SGML or
1438 XML for which the DTD and/or processing tools are not generally
1439 available, and the machine-generated HTML, PostScript or PDF
1440 produced by some word processors for output purposes only.
1441
1442 The "Title Page" means, for a printed book, the title page itself,
1443 plus such following pages as are needed to hold, legibly, the
1444 material this License requires to appear in the title page. For
1445 works in formats which do not have any title page as such, "Title
1446 Page" means the text near the most prominent appearance of the
1447 work's title, preceding the beginning of the body of the text.
1448
1449 The "publisher" means any person or entity that distributes copies
1450 of the Document to the public.
1451
1452 A section "Entitled XYZ" means a named subunit of the Document
1453 whose title either is precisely XYZ or contains XYZ in parentheses
1454 following text that translates XYZ in another language. (Here XYZ
1455 stands for a specific section name mentioned below, such as
1456 "Acknowledgements", "Dedications", "Endorsements", or "History".)
1457 To "Preserve the Title" of such a section when you modify the
1458 Document means that it remains a section "Entitled XYZ" according
1459 to this definition.
1460
1461 The Document may include Warranty Disclaimers next to the notice
1462 which states that this License applies to the Document. These
1463 Warranty Disclaimers are considered to be included by reference in
1464 this License, but only as regards disclaiming warranties: any other
1465 implication that these Warranty Disclaimers may have is void and
1466 has no effect on the meaning of this License.
1467
1468 2. VERBATIM COPYING
1469
1470 You may copy and distribute the Document in any medium, either
1471 commercially or noncommercially, provided that this License, the
1472 copyright notices, and the license notice saying this License
1473 applies to the Document are reproduced in all copies, and that you
1474 add no other conditions whatsoever to those of this License. You
1475 may not use technical measures to obstruct or control the reading
1476 or further copying of the copies you make or distribute. However,
1477 you may accept compensation in exchange for copies. If you
1478 distribute a large enough number of copies you must also follow
1479 the conditions in section 3.
1480
1481 You may also lend copies, under the same conditions stated above,
1482 and you may publicly display copies.
1483
1484 3. COPYING IN QUANTITY
1485
1486 If you publish printed copies (or copies in media that commonly
1487 have printed covers) of the Document, numbering more than 100, and
1488 the Document's license notice requires Cover Texts, you must
1489 enclose the copies in covers that carry, clearly and legibly, all
1490 these Cover Texts: Front-Cover Texts on the front cover, and
1491 Back-Cover Texts on the back cover. Both covers must also clearly
1492 and legibly identify you as the publisher of these copies. The
1493 front cover must present the full title with all words of the
1494 title equally prominent and visible. You may add other material
1495 on the covers in addition. Copying with changes limited to the
1496 covers, as long as they preserve the title of the Document and
1497 satisfy these conditions, can be treated as verbatim copying in
1498 other respects.
1499
1500 If the required texts for either cover are too voluminous to fit
1501 legibly, you should put the first ones listed (as many as fit
1502 reasonably) on the actual cover, and continue the rest onto
1503 adjacent pages.
1504
1505 If you publish or distribute Opaque copies of the Document
1506 numbering more than 100, you must either include a
1507 machine-readable Transparent copy along with each Opaque copy, or
1508 state in or with each Opaque copy a computer-network location from
1509 which the general network-using public has access to download
1510 using public-standard network protocols a complete Transparent
1511 copy of the Document, free of added material. If you use the
1512 latter option, you must take reasonably prudent steps, when you
1513 begin distribution of Opaque copies in quantity, to ensure that
1514 this Transparent copy will remain thus accessible at the stated
1515 location until at least one year after the last time you
1516 distribute an Opaque copy (directly or through your agents or
1517 retailers) of that edition to the public.
1518
1519 It is requested, but not required, that you contact the authors of
1520 the Document well before redistributing any large number of
1521 copies, to give them a chance to provide you with an updated
1522 version of the Document.
1523
1524 4. MODIFICATIONS
1525
1526 You may copy and distribute a Modified Version of the Document
1527 under the conditions of sections 2 and 3 above, provided that you
1528 release the Modified Version under precisely this License, with
1529 the Modified Version filling the role of the Document, thus
1530 licensing distribution and modification of the Modified Version to
1531 whoever possesses a copy of it. In addition, you must do these
1532 things in the Modified Version:
1533
1534 A. Use in the Title Page (and on the covers, if any) a title
1535 distinct from that of the Document, and from those of
1536 previous versions (which should, if there were any, be listed
1537 in the History section of the Document). You may use the
1538 same title as a previous version if the original publisher of
1539 that version gives permission.
1540
1541 B. List on the Title Page, as authors, one or more persons or
1542 entities responsible for authorship of the modifications in
1543 the Modified Version, together with at least five of the
1544 principal authors of the Document (all of its principal
1545 authors, if it has fewer than five), unless they release you
1546 from this requirement.
1547
1548 C. State on the Title page the name of the publisher of the
1549 Modified Version, as the publisher.
1550
1551 D. Preserve all the copyright notices of the Document.
1552
1553 E. Add an appropriate copyright notice for your modifications
1554 adjacent to the other copyright notices.
1555
1556 F. Include, immediately after the copyright notices, a license
1557 notice giving the public permission to use the Modified
1558 Version under the terms of this License, in the form shown in
1559 the Addendum below.
1560
1561 G. Preserve in that license notice the full lists of Invariant
1562 Sections and required Cover Texts given in the Document's
1563 license notice.
1564
1565 H. Include an unaltered copy of this License.
1566
1567 I. Preserve the section Entitled "History", Preserve its Title,
1568 and add to it an item stating at least the title, year, new
1569 authors, and publisher of the Modified Version as given on
1570 the Title Page. If there is no section Entitled "History" in
1571 the Document, create one stating the title, year, authors,
1572 and publisher of the Document as given on its Title Page,
1573 then add an item describing the Modified Version as stated in
1574 the previous sentence.
1575
1576 J. Preserve the network location, if any, given in the Document
1577 for public access to a Transparent copy of the Document, and
1578 likewise the network locations given in the Document for
1579 previous versions it was based on. These may be placed in
1580 the "History" section. You may omit a network location for a
1581 work that was published at least four years before the
1582 Document itself, or if the original publisher of the version
1583 it refers to gives permission.
1584
1585 K. For any section Entitled "Acknowledgements" or "Dedications",
1586 Preserve the Title of the section, and preserve in the
1587 section all the substance and tone of each of the contributor
1588 acknowledgements and/or dedications given therein.
1589
1590 L. Preserve all the Invariant Sections of the Document,
1591 unaltered in their text and in their titles. Section numbers
1592 or the equivalent are not considered part of the section
1593 titles.
1594
1595 M. Delete any section Entitled "Endorsements". Such a section
1596 may not be included in the Modified Version.
1597
1598 N. Do not retitle any existing section to be Entitled
1599 "Endorsements" or to conflict in title with any Invariant
1600 Section.
1601
1602 O. Preserve any Warranty Disclaimers.
1603
1604 If the Modified Version includes new front-matter sections or
1605 appendices that qualify as Secondary Sections and contain no
1606 material copied from the Document, you may at your option
1607 designate some or all of these sections as invariant. To do this,
1608 add their titles to the list of Invariant Sections in the Modified
1609 Version's license notice. These titles must be distinct from any
1610 other section titles.
1611
1612 You may add a section Entitled "Endorsements", provided it contains
1613 nothing but endorsements of your Modified Version by various
1614 parties--for example, statements of peer review or that the text
1615 has been approved by an organization as the authoritative
1616 definition of a standard.
1617
1618 You may add a passage of up to five words as a Front-Cover Text,
1619 and a passage of up to 25 words as a Back-Cover Text, to the end
1620 of the list of Cover Texts in the Modified Version. Only one
1621 passage of Front-Cover Text and one of Back-Cover Text may be
1622 added by (or through arrangements made by) any one entity. If the
1623 Document already includes a cover text for the same cover,
1624 previously added by you or by arrangement made by the same entity
1625 you are acting on behalf of, you may not add another; but you may
1626 replace the old one, on explicit permission from the previous
1627 publisher that added the old one.
1628
1629 The author(s) and publisher(s) of the Document do not by this
1630 License give permission to use their names for publicity for or to
1631 assert or imply endorsement of any Modified Version.
1632
1633 5. COMBINING DOCUMENTS
1634
1635 You may combine the Document with other documents released under
1636 this License, under the terms defined in section 4 above for
1637 modified versions, provided that you include in the combination
1638 all of the Invariant Sections of all of the original documents,
1639 unmodified, and list them all as Invariant Sections of your
1640 combined work in its license notice, and that you preserve all
1641 their Warranty Disclaimers.
1642
1643 The combined work need only contain one copy of this License, and
1644 multiple identical Invariant Sections may be replaced with a single
1645 copy. If there are multiple Invariant Sections with the same name
1646 but different contents, make the title of each such section unique
1647 by adding at the end of it, in parentheses, the name of the
1648 original author or publisher of that section if known, or else a
1649 unique number. Make the same adjustment to the section titles in
1650 the list of Invariant Sections in the license notice of the
1651 combined work.
1652
1653 In the combination, you must combine any sections Entitled
1654 "History" in the various original documents, forming one section
1655 Entitled "History"; likewise combine any sections Entitled
1656 "Acknowledgements", and any sections Entitled "Dedications". You
1657 must delete all sections Entitled "Endorsements."
1658
1659 6. COLLECTIONS OF DOCUMENTS
1660
1661 You may make a collection consisting of the Document and other
1662 documents released under this License, and replace the individual
1663 copies of this License in the various documents with a single copy
1664 that is included in the collection, provided that you follow the
1665 rules of this License for verbatim copying of each of the
1666 documents in all other respects.
1667
1668 You may extract a single document from such a collection, and
1669 distribute it individually under this License, provided you insert
1670 a copy of this License into the extracted document, and follow
1671 this License in all other respects regarding verbatim copying of
1672 that document.
1673
1674 7. AGGREGATION WITH INDEPENDENT WORKS
1675
1676 A compilation of the Document or its derivatives with other
1677 separate and independent documents or works, in or on a volume of
1678 a storage or distribution medium, is called an "aggregate" if the
1679 copyright resulting from the compilation is not used to limit the
1680 legal rights of the compilation's users beyond what the individual
1681 works permit. When the Document is included in an aggregate, this
1682 License does not apply to the other works in the aggregate which
1683 are not themselves derivative works of the Document.
1684
1685 If the Cover Text requirement of section 3 is applicable to these
1686 copies of the Document, then if the Document is less than one half
1687 of the entire aggregate, the Document's Cover Texts may be placed
1688 on covers that bracket the Document within the aggregate, or the
1689 electronic equivalent of covers if the Document is in electronic
1690 form. Otherwise they must appear on printed covers that bracket
1691 the whole aggregate.
1692
1693 8. TRANSLATION
1694
1695 Translation is considered a kind of modification, so you may
1696 distribute translations of the Document under the terms of section
1697 4. Replacing Invariant Sections with translations requires special
1698 permission from their copyright holders, but you may include
1699 translations of some or all Invariant Sections in addition to the
1700 original versions of these Invariant Sections. You may include a
1701 translation of this License, and all the license notices in the
1702 Document, and any Warranty Disclaimers, provided that you also
1703 include the original English version of this License and the
1704 original versions of those notices and disclaimers. In case of a
1705 disagreement between the translation and the original version of
1706 this License or a notice or disclaimer, the original version will
1707 prevail.
1708
1709 If a section in the Document is Entitled "Acknowledgements",
1710 "Dedications", or "History", the requirement (section 4) to
1711 Preserve its Title (section 1) will typically require changing the
1712 actual title.
1713
1714 9. TERMINATION
1715
1716 You may not copy, modify, sublicense, or distribute the Document
1717 except as expressly provided under this License. Any attempt
1718 otherwise to copy, modify, sublicense, or distribute it is void,
1719 and will automatically terminate your rights under this License.
1720
1721 However, if you cease all violation of this License, then your
1722 license from a particular copyright holder is reinstated (a)
1723 provisionally, unless and until the copyright holder explicitly
1724 and finally terminates your license, and (b) permanently, if the
1725 copyright holder fails to notify you of the violation by some
1726 reasonable means prior to 60 days after the cessation.
1727
1728 Moreover, your license from a particular copyright holder is
1729 reinstated permanently if the copyright holder notifies you of the
1730 violation by some reasonable means, this is the first time you have
1731 received notice of violation of this License (for any work) from
1732 that copyright holder, and you cure the violation prior to 30 days
1733 after your receipt of the notice.
1734
1735 Termination of your rights under this section does not terminate
1736 the licenses of parties who have received copies or rights from
1737 you under this License. If your rights have been terminated and
1738 not permanently reinstated, receipt of a copy of some or all of
1739 the same material does not give you any rights to use it.
1740
1741 10. FUTURE REVISIONS OF THIS LICENSE
1742
1743 The Free Software Foundation may publish new, revised versions of
1744 the GNU Free Documentation License from time to time. Such new
1745 versions will be similar in spirit to the present version, but may
1746 differ in detail to address new problems or concerns. See
1747 `http://www.gnu.org/copyleft/'.
1748
1749 Each version of the License is given a distinguishing version
1750 number. If the Document specifies that a particular numbered
1751 version of this License "or any later version" applies to it, you
1752 have the option of following the terms and conditions either of
1753 that specified version or of any later version that has been
1754 published (not as a draft) by the Free Software Foundation. If
1755 the Document does not specify a version number of this License,
1756 you may choose any version ever published (not as a draft) by the
1757 Free Software Foundation. If the Document specifies that a proxy
1758 can decide which future versions of this License can be used, that
1759 proxy's public statement of acceptance of a version permanently
1760 authorizes you to choose that version for the Document.
1761
1762 11. RELICENSING
1763
1764 "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
1765 World Wide Web server that publishes copyrightable works and also
1766 provides prominent facilities for anybody to edit those works. A
1767 public wiki that anybody can edit is an example of such a server.
1768 A "Massive Multiauthor Collaboration" (or "MMC") contained in the
1769 site means any set of copyrightable works thus published on the MMC
1770 site.
1771
1772 "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
1773 license published by Creative Commons Corporation, a not-for-profit
1774 corporation with a principal place of business in San Francisco,
1775 California, as well as future copyleft versions of that license
1776 published by that same organization.
1777
1778 "Incorporate" means to publish or republish a Document, in whole or
1779 in part, as part of another Document.
1780
1781 An MMC is "eligible for relicensing" if it is licensed under this
1782 License, and if all works that were first published under this
1783 License somewhere other than this MMC, and subsequently
1784 incorporated in whole or in part into the MMC, (1) had no cover
1785 texts or invariant sections, and (2) were thus incorporated prior
1786 to November 1, 2008.
1787
1788 The operator of an MMC Site may republish an MMC contained in the
1789 site under CC-BY-SA on the same site at any time before August 1,
1790 2009, provided the MMC is eligible for relicensing.
1791
1792
1793ADDENDUM: How to use this License for your documents
1794====================================================
1795
1796To use this License in a document you have written, include a copy of
1797the License in the document and put the following copyright and license
1798notices just after the title page:
1799
1800 Copyright (C) YEAR YOUR NAME.
1801 Permission is granted to copy, distribute and/or modify this document
1802 under the terms of the GNU Free Documentation License, Version 1.3
1803 or any later version published by the Free Software Foundation;
1804 with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
1805 Texts. A copy of the license is included in the section entitled ``GNU
1806 Free Documentation License''.
1807
1808 If you have Invariant Sections, Front-Cover Texts and Back-Cover
1809Texts, replace the "with...Texts." line with this:
1810
1811 with the Invariant Sections being LIST THEIR TITLES, with
1812 the Front-Cover Texts being LIST, and with the Back-Cover Texts
1813 being LIST.
1814
1815 If you have Invariant Sections without Cover Texts, or some other
1816combination of the three, merge those two alternatives to suit the
1817situation.
1818
1819 If your document contains nontrivial examples of program code, we
1820recommend releasing these examples in parallel under your choice of
1821free software license, such as the GNU General Public License, to
1822permit their use in free software.
1823
1824
1825File: grep.info, Node: Index, Prev: Copying, Up: Top
1826
1827Index
1828*****
1829
1830[index]
1831* Menu:
1832
1833* *: Fundamental Structure.
1834 (line 21)
1835* +: Fundamental Structure.
1836 (line 24)
1837* --after-context: Context Line Control.
1838 (line 13)
1839* --basic-regexp: grep Programs. (line 16)
1840* --before-context: Context Line Control.
1841 (line 17)
1842* --binary: Other Options. (line 19)
1843* --binary-files: File and Directory Selection.
1844 (line 12)
1845* --byte-offset: Output Line Prefix Control.
1846 (line 12)
1847* --color: General Output Control.
1848 (line 14)
1849* --colour: General Output Control.
1850 (line 14)
1851* --context: Context Line Control.
1852 (line 22)
1853* --count: General Output Control.
1854 (line 8)
1855* --dereference-recursive: File and Directory Selection.
1856 (line 82)
1857* --devices: File and Directory Selection.
1858 (line 30)
1859* --directories: File and Directory Selection.
1860 (line 42)
1861* --exclude: File and Directory Selection.
1862 (line 53)
1863* --exclude-dir: File and Directory Selection.
1864 (line 62)
1865* --exclude-from: File and Directory Selection.
1866 (line 58)
1867* --extended-regexp: grep Programs. (line 21)
1868* --file: Matching Control. (line 14)
1869* --files-with-matches: General Output Control.
1870 (line 35)
1871* --files-without-match: General Output Control.
1872 (line 29)
1873* --fixed-strings: grep Programs. (line 26)
1874* --group-separator: Context Line Control.
1875 (line 25)
1876* --help: Generic Program Information.
1877 (line 7)
1878* --ignore-case: Matching Control. (line 21)
1879* --include: File and Directory Selection.
1880 (line 70)
1881* --initial-tab: Output Line Prefix Control.
1882 (line 43)
1883* --invert-match: Matching Control. (line 27)
1884* --label: Output Line Prefix Control.
1885 (line 30)
1886* --line-buffered: Other Options. (line 7)
1887* --line-number: Output Line Prefix Control.
1888 (line 38)
1889* --line-regexp: Matching Control. (line 41)
1890* --max-count: General Output Control.
1891 (line 42)
1892* --mmap: Other Options. (line 11)
1893* --no-filename: Output Line Prefix Control.
1894 (line 25)
1895* --no-messages: General Output Control.
1896 (line 88)
1897* --null: Output Line Prefix Control.
1898 (line 63)
1899* --null-data: Other Options. (line 33)
1900* --only-matching: General Output Control.
1901 (line 75)
1902* --perl-regexp: grep Programs. (line 32)
1903* --quiet: General Output Control.
1904 (line 81)
1905* --recursive: File and Directory Selection.
1906 (line 75)
1907* --regexp=PATTERN: Matching Control. (line 8)
1908* --silent: General Output Control.
1909 (line 81)
1910* --text: File and Directory Selection.
1911 (line 8)
1912* --unix-byte-offsets: Output Line Prefix Control.
1913 (line 53)
1914* --version: Generic Program Information.
1915 (line 12)
1916* --with-filename: Output Line Prefix Control.
1917 (line 20)
1918* --word-regexp: Matching Control. (line 32)
1919* -a: File and Directory Selection.
1920 (line 8)
1921* -A: Context Line Control.
1922 (line 13)
1923* -B: Context Line Control.
1924 (line 17)
1925* -b: Output Line Prefix Control.
1926 (line 12)
1927* -C: Context Line Control.
1928 (line 22)
1929* -c: General Output Control.
1930 (line 8)
1931* -d: File and Directory Selection.
1932 (line 42)
1933* -D: File and Directory Selection.
1934 (line 30)
1935* -E: grep Programs. (line 21)
1936* -e: Matching Control. (line 8)
1937* -F: grep Programs. (line 26)
1938* -f: Matching Control. (line 14)
1939* -G: grep Programs. (line 16)
1940* -h: Output Line Prefix Control.
1941 (line 25)
1942* -H: Output Line Prefix Control.
1943 (line 20)
1944* -i: Matching Control. (line 21)
1945* -l: General Output Control.
1946 (line 35)
1947* -L: General Output Control.
1948 (line 29)
1949* -m: General Output Control.
1950 (line 42)
1951* -n: Output Line Prefix Control.
1952 (line 38)
1953* -NUM: Context Line Control.
1954 (line 22)
1955* -o: General Output Control.
1956 (line 75)
1957* -P: grep Programs. (line 32)
1958* -q: General Output Control.
1959 (line 81)
1960* -R: File and Directory Selection.
1961 (line 82)
1962* -r: File and Directory Selection.
1963 (line 75)
1964* -s: General Output Control.
1965 (line 88)
1966* -T: Output Line Prefix Control.
1967 (line 43)
1968* -U: Other Options. (line 19)
1969* -u: Output Line Prefix Control.
1970 (line 53)
1971* -v: Matching Control. (line 27)
1972* -V: Generic Program Information.
1973 (line 12)
1974* -w: Matching Control. (line 32)
1975* -x: Matching Control. (line 41)
1976* -y: Matching Control. (line 21)
1977* -z: Other Options. (line 33)
1978* -Z: Output Line Prefix Control.
1979 (line 63)
1980* .: Fundamental Structure.
1981 (line 15)
1982* ?: Fundamental Structure.
1983 (line 18)
1984* _N_GNU_nonoption_argv_flags_ environment variable: Environment Variables.
1985 (line 189)
1986* after context: Context Line Control.
1987 (line 13)
1988* alnum character class: Character Classes and Bracket Expressions.
1989 (line 29)
1990* alpha character class: Character Classes and Bracket Expressions.
1991 (line 34)
1992* alphabetic characters: Character Classes and Bracket Expressions.
1993 (line 34)
1994* alphanumeric characters: Character Classes and Bracket Expressions.
1995 (line 29)
1996* anchoring: Anchoring. (line 6)
1997* asterisk: Fundamental Structure.
1998 (line 21)
1999* back-reference: Back-references and Subexpressions.
2000 (line 6)
2001* backslash: The Backslash Character and Special Expressions.
2002 (line 6)
2003* basic regular expressions: Basic vs Extended. (line 6)
2004* before context: Context Line Control.
2005 (line 17)
2006* binary files: File and Directory Selection.
2007 (line 8)
2008* binary files, MS-DOS/MS-Windows: Other Options. (line 19)
2009* blank character class: Character Classes and Bracket Expressions.
2010 (line 39)
2011* blank characters: Character Classes and Bracket Expressions.
2012 (line 39)
2013* bn GREP_COLORS capability: Environment Variables.
2014 (line 134)
2015* braces, first argument omitted: Fundamental Structure.
2016 (line 33)
2017* braces, one argument: Fundamental Structure.
2018 (line 27)
2019* braces, second argument omitted: Fundamental Structure.
2020 (line 30)
2021* braces, two arguments: Fundamental Structure.
2022 (line 36)
2023* bracket expression: Character Classes and Bracket Expressions.
2024 (line 6)
2025* Bugs, known: Reporting Bugs. (line 14)
2026* bugs, reporting: Reporting Bugs. (line 6)
2027* byte offset: Output Line Prefix Control.
2028 (line 12)
2029* byte offsets, on MS-DOS/MS-Windows: Output Line Prefix Control.
2030 (line 53)
2031* case insensitive search: Matching Control. (line 21)
2032* changing name of standard input: Output Line Prefix Control.
2033 (line 30)
2034* character class: Character Classes and Bracket Expressions.
2035 (line 6)
2036* character classes: Character Classes and Bracket Expressions.
2037 (line 28)
2038* character type: Environment Variables.
2039 (line 161)
2040* classes of characters: Character Classes and Bracket Expressions.
2041 (line 28)
2042* cntrl character class: Character Classes and Bracket Expressions.
2043 (line 42)
2044* context: Context Line Control.
2045 (line 22)
2046* context lines, after match: Context Line Control.
2047 (line 13)
2048* context lines, before match: Context Line Control.
2049 (line 17)
2050* control characters: Character Classes and Bracket Expressions.
2051 (line 42)
2052* copying: Copying. (line 6)
2053* counting lines: General Output Control.
2054 (line 8)
2055* cx GREP_COLORS capability: Environment Variables.
2056 (line 85)
2057* default options environment variable: Environment Variables.
2058 (line 41)
2059* device search: File and Directory Selection.
2060 (line 30)
2061* digit character class: Character Classes and Bracket Expressions.
2062 (line 47)
2063* digit characters: Character Classes and Bracket Expressions.
2064 (line 47)
2065* directory search: File and Directory Selection.
2066 (line 42)
2067* dot: Fundamental Structure.
2068 (line 15)
2069* environment variables: Environment Variables.
2070 (line 40)
2071* exclude directories: File and Directory Selection.
2072 (line 62)
2073* exclude files: File and Directory Selection.
2074 (line 53)
2075* exit status: Exit Status. (line 6)
2076* FAQ about grep usage: Usage. (line 17)
2077* files which don't match: General Output Control.
2078 (line 29)
2079* fn GREP_COLORS capability: Environment Variables.
2080 (line 124)
2081* graph character class: Character Classes and Bracket Expressions.
2082 (line 50)
2083* graphic characters: Character Classes and Bracket Expressions.
2084 (line 50)
2085* grep programs: grep Programs. (line 6)
2086* GREP_COLOR environment variable: Environment Variables.
2087 (line 58)
2088* GREP_COLORS environment variable: Environment Variables.
2089 (line 69)
2090* GREP_OPTIONS environment variable: Environment Variables.
2091 (line 41)
2092* group separator: Context Line Control.
2093 (line 25)
2094* hexadecimal digits: Character Classes and Bracket Expressions.
2095 (line 76)
2096* highlight markers: Environment Variables.
2097 (line 58)
2098* highlight, color, colour: General Output Control.
2099 (line 14)
2100* include files: File and Directory Selection.
2101 (line 70)
2102* interval specifications: Basic vs Extended. (line 10)
2103* invert matching: Matching Control. (line 27)
2104* LANG environment variable: Environment Variables.
2105 (line 161)
2106* language of messages: Environment Variables.
2107 (line 175)
2108* LC_ALL environment variable: Environment Variables.
2109 (line 161)
2110* LC_COLLATE environment variable: Environment Variables.
2111 (line 161)
2112* LC_CTYPE environment variable: Environment Variables.
2113 (line 168)
2114* LC_MESSAGES environment variable: Environment Variables.
2115 (line 175)
2116* line buffering: Other Options. (line 7)
2117* line numbering: Output Line Prefix Control.
2118 (line 38)
2119* ln GREP_COLORS capability: Environment Variables.
2120 (line 129)
2121* lower character class: Character Classes and Bracket Expressions.
2122 (line 53)
2123* lower-case letters: Character Classes and Bracket Expressions.
2124 (line 53)
2125* match expression at most M times: Fundamental Structure.
2126 (line 33)
2127* match expression at most once: Fundamental Structure.
2128 (line 18)
2129* match expression from N to M times: Fundamental Structure.
2130 (line 36)
2131* match expression N or more times: Fundamental Structure.
2132 (line 30)
2133* match expression N times: Fundamental Structure.
2134 (line 27)
2135* match expression one or more times: Fundamental Structure.
2136 (line 24)
2137* match expression zero or more times: Fundamental Structure.
2138 (line 21)
2139* match the whole line: Matching Control. (line 41)
2140* matching basic regular expressions: grep Programs. (line 16)
2141* matching extended regular expressions: grep Programs. (line 21)
2142* matching fixed strings: grep Programs. (line 26)
2143* matching Perl regular expressions: grep Programs. (line 32)
2144* matching whole words: Matching Control. (line 32)
2145* max-count: General Output Control.
2146 (line 42)
2147* mc GREP_COLORS capability: Environment Variables.
2148 (line 116)
2149* memory mapped input: Other Options. (line 11)
2150* message language: Environment Variables.
2151 (line 175)
2152* ms GREP_COLORS capability: Environment Variables.
2153 (line 108)
2154* MS-DOS/MS-Windows binary files: Other Options. (line 19)
2155* MS-DOS/MS-Windows byte offsets: Output Line Prefix Control.
2156 (line 53)
2157* mt GREP_COLORS capability: Environment Variables.
2158 (line 100)
2159* names of matching files: General Output Control.
2160 (line 35)
2161* national language support: Environment Variables.
2162 (line 161)
2163* ne GREP_COLORS capability: Environment Variables.
2164 (line 146)
2165* NLS: Environment Variables.
2166 (line 161)
2167* no filename prefix: Output Line Prefix Control.
2168 (line 25)
2169* numeric characters: Character Classes and Bracket Expressions.
2170 (line 47)
2171* only matching: General Output Control.
2172 (line 75)
2173* palindromes: Usage. (line 139)
2174* pattern from file: Matching Control. (line 14)
2175* pattern list: Matching Control. (line 8)
2176* period: Fundamental Structure.
2177 (line 15)
2178* plus sign: Fundamental Structure.
2179 (line 24)
2180* POSIXLY_CORRECT environment variable: Environment Variables.
2181 (line 180)
2182* print character class: Character Classes and Bracket Expressions.
2183 (line 58)
2184* print non-matching lines: Matching Control. (line 27)
2185* printable characters: Character Classes and Bracket Expressions.
2186 (line 58)
2187* punct character class: Character Classes and Bracket Expressions.
2188 (line 61)
2189* punctuation characters: Character Classes and Bracket Expressions.
2190 (line 61)
2191* question mark: Fundamental Structure.
2192 (line 18)
2193* quiet, silent: General Output Control.
2194 (line 81)
2195* range expression: Character Classes and Bracket Expressions.
2196 (line 12)
2197* recursive search: File and Directory Selection.
2198 (line 75)
2199* regular expressions: Regular Expressions. (line 6)
2200* return status: Exit Status. (line 6)
2201* rv GREP_COLORS capability: Environment Variables.
2202 (line 94)
2203* searching directory trees: File and Directory Selection.
2204 (line 53)
2205* searching for a pattern: Introduction. (line 6)
2206* sl GREP_COLORS capability: Environment Variables.
2207 (line 77)
2208* space character class: Character Classes and Bracket Expressions.
2209 (line 66)
2210* space characters: Character Classes and Bracket Expressions.
2211 (line 66)
2212* subexpression: Back-references and Subexpressions.
2213 (line 6)
2214* suppress binary data: File and Directory Selection.
2215 (line 8)
2216* suppress error messages: General Output Control.
2217 (line 88)
2218* symbolic links: File and Directory Selection.
2219 (line 42)
2220* tab-aligned content lines: Output Line Prefix Control.
2221 (line 43)
2222* translation of message language: Environment Variables.
2223 (line 175)
2224* upper character class: Character Classes and Bracket Expressions.
2225 (line 71)
2226* upper-case letters: Character Classes and Bracket Expressions.
2227 (line 71)
2228* usage summary, printing: Generic Program Information.
2229 (line 7)
2230* usage, examples: Usage. (line 6)
2231* using grep, Q&A: Usage. (line 17)
2232* variants of grep: grep Programs. (line 6)
2233* version, printing: Generic Program Information.
2234 (line 12)
2235* whitespace characters: Character Classes and Bracket Expressions.
2236 (line 66)
2237* with filename prefix: Output Line Prefix Control.
2238 (line 20)
2239* xdigit character class: Character Classes and Bracket Expressions.
2240 (line 76)
2241* xdigit class: Character Classes and Bracket Expressions.
2242 (line 76)
2243* zero-terminated file names: Output Line Prefix Control.
2244 (line 63)
2245* zero-terminated lines: Other Options. (line 33)
2246* {,M}: Fundamental Structure.
2247 (line 33)
2248* {N,M}: Fundamental Structure.
2249 (line 36)
2250* {N,}: Fundamental Structure.
2251 (line 30)
2252* {N}: Fundamental Structure.
2253 (line 27)
2254
2255
2256
2257Tag Table:
2258Node: Top764
2259Node: Introduction1879
2260Node: Invoking2607
2261Node: Command-line Options3352
2262Node: Generic Program Information4227
2263Node: Matching Control4686
2264Node: General Output Control6135
2265Ref: General Output Control-Footnote-110048
2266Node: Output Line Prefix Control10117
2267Node: Context Line Control13052
2268Node: File and Directory Selection14984
2269Node: Other Options18528
2270Node: Environment Variables20064
2271Node: Exit Status29560
2272Node: grep Programs30201
2273Node: Regular Expressions31619
2274Node: Fundamental Structure32771
2275Node: Character Classes and Bracket Expressions34465
2276Ref: invalid-bracket-expr37654
2277Node: The Backslash Character and Special Expressions38831
2278Node: Anchoring39830
2279Node: Back-references and Subexpressions40273
2280Node: Basic vs Extended40983
2281Node: Usage41978
2282Node: Reporting Bugs49235
2283Node: Copying49897
2284Node: GNU Free Documentation License50984
2285Node: Index76111
2286
2287End Tag Table
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette