1 \input texinfo @c -*-texinfo-*-
4 @settitle grep, print lines matching a pattern
7 @c This file has the new style title page commands.
8 @c Run `makeinfo' rather than `texinfo-format-buffer'.
29 * grep: (grep). print lines matching a pattern.
31 This file documents @command{grep}, a pattern matching engine.
34 Published by the Free Software Foundation,
35 59 Temple Place - Suite 330
36 Boston, MA 02111-1307, USA
38 Copyright 1999 Free Software Foundation, Inc.
40 Permission is granted to make and distribute verbatim copies of
41 this manual provided the copyright notice and this permission notice
42 are preserved on all copies.
45 Permission is granted to process this file through TeX and print the
46 results, provided the printed document carries copying permission
47 notice identical to this one except for the removal of this paragraph
48 (this paragraph not being relevant to the printed manual).
51 Permission is granted to copy and distribute modified versions of this
52 manual under the conditions for verbatim copying, provided that the entire
53 resulting derived work is distributed under the terms of a permission
54 notice identical to this one.
56 Permission is granted to copy and distribute translations of this manual
57 into another language, under the above conditions for modified versions,
58 except that this permission notice may be stated in a translation approved
62 @setchapternewpage off
65 @title grep, searching for a pattern
66 @subtitle version @value{VERSION}, @value{UPDATED}
67 @author Alain Magloire et al.
70 @vskip 0pt plus 1filll
71 Copyright @copyright{} 1999 Free Software Foundation, Inc.
74 Published by the Free Software Foundation, @*
75 59 Temple Place - Suite 330, @*
76 Boston, MA 02111-1307, USA
78 Permission is granted to make and distribute verbatim copies of
79 this manual provided the copyright notice and this permission notice
80 are preserved on all copies.
82 Permission is granted to copy and distribute modified versions of this
83 manual under the conditions for verbatim copying, provided that the entire
84 resulting derived work is distributed under the terms of a permission
85 notice identical to this one.
87 Permission is granted to copy and distribute translations of this manual
88 into another language, under the above conditions for modified versions,
89 except that this permission notice may be stated in a translation approved
100 @command{grep} searches for lines matching a pattern.
102 This document was produced for version @value{VERSION} of @sc{gnu}
107 * Introduction:: Introduction.
108 * Invoking:: Invoking @command{grep}; description of options.
109 * Diagnostics:: Exit status returned by @command{grep}.
110 * Grep Programs:: @command{grep} programs.
111 * Regular Expressions:: Regular Expressions.
113 * Reporting Bugs:: Reporting Bugs.
114 * Concept Index:: A menu with all the topics in this manual.
115 * Index:: A menu with all @command{grep} commands
116 and command-line options.
121 @chapter Introduction
123 @cindex Searching for a pattern.
125 @command{grep} searches the input files
126 for lines containing a match to a given
127 pattern list. When it finds a match in a line, it copies the line to standard
128 output (by default), or does whatever other sort of output you have requested
131 Though @command{grep} expects to do the matching on text,
132 it has no limits on input line length other than available memory,
133 and it can match arbitrary characters within a line.
134 If the final byte of an input file is not a newline,
135 @command{grep} silently supplies one.
136 Since newline is also a separator for the list of patterns, there
137 is no way to match newline characters in a text.
140 @chapter Invoking @command{grep}
142 @command{grep} comes with a rich set of options from @sc{posix.2} and @sc{gnu}
151 @cindex counting lines
152 Suppress normal output; instead print a count of matching
153 lines for each input file. With the @samp{-v}, @samp{--invert-match} option,
154 count non-matching lines.
156 @item -e @var{pattern}
157 @itemx --regexp=@var{pattern}
159 @opindex --regexp=@var{pattern}
161 Use @var{pattern} as the pattern; useful to protect patterns
162 beginning with a @samp{-}.
165 @itemx --file=@var{file}
168 @cindex pattern from file
169 Obtain patterns from @var{file}, one per line. The empty
170 file contains zero patterns, and therefore matches nothing.
175 @opindex --ignore-case
176 @cindex case insensitive search
177 Ignore case distinctions in both the pattern and the input files.
180 @itemx --files-with-matches
182 @opindex --files-with-matches
183 @cindex names of matching files
184 Suppress normal output; instead print the name of each input
185 file from which output would normally have been printed.
186 The scanning of every file will stop on the first match.
191 @opindex --line-number
192 @cindex line numbering
193 Prefix each line of output with the line number within its input file.
201 @cindex quiet, silent
202 Quiet; suppress normal output. The scanning of every file will stop on
203 the first match. Also see the @samp{-s} or @samp{--no-messages} option.
208 @opindex --no-messages
209 @cindex suppress error messages
210 Suppress error messages about nonexistent or unreadable files.
211 Portability note: unlike @sc{gnu} @command{grep}, traditional
212 @command{grep} did not conform to @sc{posix.2}, because traditional
213 @command{grep} lacked a @samp{-q} option and its @samp{-s} option behaved
214 like @sc{gnu} @command{grep}'s @samp{-q} option. Shell scripts intended
215 to be portable to traditional @command{grep} should avoid both
216 @samp{-q} and @samp{-s} and should redirect
217 output to @file{/dev/null} instead.
220 @itemx --invert-match
222 @opindex --invert-match
223 @cindex invert matching
224 @cindex print non-matching lines
225 Invert the sense of matching, to select non-matching lines.
230 @opindex --line-regexp
231 @cindex match the whole line
232 Select only those matches that exactly match the whole line.
236 @section @sc{gnu} Extensions
241 @itemx --after-context=@var{num}
243 @opindex --after-context
244 @cindex after context
245 @cindex context lines, after match
246 Print @var{num} lines of trailing context after matching lines.
249 @itemx --before-context=@var{num}
251 @opindex --before-context
252 @cindex before context
253 @cindex context lines, before match
254 Print @var{num} lines of leading context before matching lines.
257 @itemx --context=[@var{num}]
261 Print @var{num} lines (default 2) of output context.
266 Same as @samp{--context=@var{num}} lines of leading and trailing
267 context. However, grep will never print any given line more than once.
274 @cindex Version, printing
275 Print the version number of @command{grep} to the standard output stream.
276 This version number should be included in all bug reports.
280 @cindex Usage summary, printing
281 Print a usage message briefly summarizing these command-line options
282 and the bug-reporting address, then exit.
284 @itemx --binary-files=@var{type}
285 @opindex --binary-files
287 If the first few bytes of a file indicate that the file contains binary
288 data, assume that the file is of type @var{type}. By default,
289 @var{type} is @samp{binary}, and @command{grep} normally outputs either
290 a one-line message saying that a binary file matches, or no message if
291 there is no match. If @var{type} is @samp{without-match},
292 @command{grep} assumes that a binary file does not match;
293 this is equivalent to the @samp{-I} option. If @var{type}
294 is @samp{text}, @command{grep} processes a binary file as if it were
295 text; this is equivalent to the @samp{-a} option.
296 @emph{Warning:} @samp{--binary-files=text} might output binary garbage,
297 which can have nasty side effects if the output is a terminal and if the
298 terminal driver interprets some of it as commands.
303 @opindex --byte-offset
305 Print the byte offset within the input file before each line of output.
306 When @command{grep} runs on @sc{ms-dos} or MS-Windows, the printed
308 depend on whether the @samp{-u} (@samp{--unix-byte-offsets}) option is
311 @item -d @var{action}
312 @itemx --directories=@var{action}
314 @opindex --directories
315 @cindex directory search
316 If an input file is a directory, use @var{action} to process it.
317 By default, @var{action} is @samp{read}, which means that directories are
318 read just as if they were ordinary files (some operating systems
319 and filesystems disallow this, and will cause @command{grep} to print error
320 messages for every directory). If @var{action} is @samp{skip},
321 directories are silently skipped. If @var{action} is @samp{recurse},
322 @command{grep} reads all files under each directory, recursively; this is
323 equivalent to the @samp{-r} option.
326 @itemx --with-filename
328 @opindex --With-filename
329 @cindex with filename prefix
330 Print the filename for each match.
335 @opindex --no-filename
336 @cindex no filename prefix
337 Suppress the prefixing of filenames on output when multiple files are searched.
340 @itemx --files-without-match
342 @opindex --files-without-match
343 @cindex files which don't match
344 Suppress normal output; instead print the name of each input
345 file from which no output would normally have been printed.
346 The scanning of every file will stop on the first match.
352 @cindex suppress binary data
354 Process a binary file as if it were text; this is equivalent to the
355 @samp{--binary-files=text} option.
358 Process a binary file as if it did not contain matching data; this is
359 equivalent to the @samp{--binary-files=without-match} option.
364 @opindex --word-regexp
365 @cindex matching whole words
366 Select only those lines containing matches that form
367 whole words. The test is that the matching substring
368 must either be at the beginning of the line, or preceded
369 by a non-word constituent character. Similarly,
370 it must be either at the end of the line or followed by
371 a non-word constituent character. Word-constituent
372 characters are letters, digits, and the underscore.
378 @cindex recursive search
379 @cindex searching directory trees
380 For each directory mentioned in the command line, read and process all
381 files in that directory, recursively. This is the same as the @samp{-d
386 @cindex case insensitive search, obsolete option
387 Obsolete synonym for @samp{-i}.
393 @cindex DOS/Windows binary files
394 @cindex binary files, DOS/Windows
395 Treat the file(s) as binary. By default, under @sc{ms-dos}
396 and MS-Windows, @command{grep} guesses the file type by looking
397 at the contents of the first 32kB read from the file.
398 If @command{grep} decides the file is a text file, it strips the
399 @code{CR} characters from the original file contents (to make
400 regular expressions with @code{^} and @code{$} work correctly).
401 Specifying @samp{-U} overrules this guesswork, causing all
402 files to be read and passed to the matching mechanism
403 verbatim; if the file is a text file with @code{CR/LF} pairs
404 at the end of each line, this will cause some regular
405 expressions to fail. This option has no effect on platforms other than
406 @sc{ms-dos} and MS-Windows.
409 @itemx --unix-byte-offsets
411 @opindex --unix-byte-offsets
412 @cindex DOS byte offsets
413 @cindex byte offsets, on DOS/Windows
414 Report Unix-style byte offsets. This switch causes
415 @command{grep} to report byte offsets as if the file were Unix style
416 text file, i.e., the byte offsets ignore the @code{CR} characters which were
417 stripped. This will produce results identical to running @command{grep} on
418 a Unix machine. This option has no effect unless @samp{-b}
419 option is also used; it has no effect on platforms other than @sc{ms-dos} and
424 @cindex memory mapped input
425 If possible, use the @code{mmap} system call to read input, instead of
426 the default @code{read} system call. In some situations, @samp{--mmap}
427 yields better performance. However, @samp{--mmap} can cause undefined
428 behavior (including core dumps) if an input file shrinks while
429 @command{grep} is operating, or if an I/O error occurs.
435 @cindex zero-terminated file names
436 Output a zero byte (the @sc{ascii} @code{NUL} character) instead of the
437 character that normally follows a file name. For example, @samp{grep
438 -lZ} outputs a zero byte after each file name instead of the usual
439 newline. This option makes the output unambiguous, even in the presence
440 of file names containing unusual characters like newlines. This option
441 can be used with commands like @samp{find -print0}, @samp{perl -0},
442 @samp{sort -z}, and @samp{xargs -0} to process arbitrary file names,
443 even those that contain newline characters.
449 @cindex zero-terminated lines
450 Treat the input as a set of lines, each terminated by a zero byte (the
451 @sc{ascii} @code{NUL} character) instead of a newline. Like the @samp{-Z}
452 or @samp{--null} option, this option can be used with commands like
453 @samp{sort -z} to process arbitrary file names.
457 Several additional options control which variant of the @command{grep}
458 matching engine is used. @xref{Grep Programs}.
460 @section Environment Variables
462 Grep's behavior is affected by the following environment variables.
463 @cindex environment variables
469 @cindex default options environment variable
470 This variable specifies default options to be placed in front of any
471 explicit options. For example, if @code{GREP_OPTIONS} is
472 @samp{--binary-files=without-match --directories=skip}, @command{grep}
473 behaves as if the two options @samp{--binary-files=without-match} and
474 @samp{--directories=skip} had been specified before
475 any explicit options. Option specifications are separated by
476 whitespace. A backslash escapes the next character, so it can be used to
477 specify an option containing whitespace or a backslash.
485 @cindex language of messages
486 @cindex message language
487 @cindex national language support
489 @cindex translation of message language
490 These variables specify the @code{LC_MESSAGES} locale, which determines
491 the language that @command{grep} uses for messages. The locale is determined
492 by the first of these variables that is set. American English is used
493 if none of these environment variables are set, or if the message
494 catalog is not installed, or if @command{grep} was not compiled with national
495 language support (@sc{nls}).
503 @cindex character type
504 @cindex national language support
506 These variables specify the @code{LC_CTYPE} locale, which determines the
507 type of characters, e.g., which characters are whitespace. The locale is
508 determined by the first of these variables that is set. The @sc{posix}
509 locale is used if none of these environment variables are set, or if the
510 locale catalog is not installed, or if @command{grep} was not compiled with
511 national language support (@sc{nls}).
513 @item POSIXLY_CORRECT
514 @vindex POSIXLY_CORRECT
515 If set, @command{grep} behaves as @sc{posix.2} requires; otherwise,
516 @command{grep} behaves more like other @sc{gnu} programs. @sc{posix.2}
517 requires that options that
518 follow file names must be treated as file names; by default, such
519 options are permuted to the front of the operand list and are treated as
520 options. Also, @sc{posix.2} requires that unrecognized options be
522 ``illegal'', but since they are not really against the law the default
523 is to diagnose them as ``invalid''. @code{POSIXLY_CORRECT} also
524 disables @code{_@var{N}_GNU_nonoption_argv_flags_}, described below.
526 @item _@var{N}_GNU_nonoption_argv_flags_
527 @vindex _@var{N}_GNU_nonoption_argv_flags_
528 (Here @code{@var{N}} is @command{grep}'s numeric process ID.) If the
529 @var{i}th character of this environment variable's value is @samp{1}, do
530 not consider the @var{i}th operand of @command{grep} to be an option, even if
531 it appears to be one. A shell can put this variable in the environment
532 for each command it runs, specifying which operands are the results of
533 file name wildcard expansion and therefore should not be treated as
534 options. This behavior is available only with the @sc{gnu} C library, and
535 only when @code{POSIXLY_CORRECT} is not set.
542 Normally, exit status is 0 if matches were found, and 1 if no matches
543 were found (the @samp{-v} option inverts the sense of the exit status).
544 Exit status is 2 if there were syntax errors in the pattern,
545 inaccessible input files, or other system errors.
548 @chapter @command{grep} programs
550 @command{grep} searches the named input files (or standard input if no
551 files are named, or the file name @file{-} is given) for lines containing
552 a match to the given pattern. By default, @command{grep} prints the
553 matching lines. There are three major variants of @command{grep},
554 controlled by the following options.
559 @itemx --basic-regexp
561 @opindex --basic-regexp
562 @cindex matching basic regular expressions
563 Interpret pattern as a basic regular expression. This is the default.
566 @itemx --extended-regexp
568 @opindex --extended-regexp
569 @cindex matching extended regular expressions
570 Interpret pattern as an extended regular expression.
574 @itemx --fixed-strings
576 @opindex --fixed-strings
577 @cindex matching fixed strings
578 Interpret pattern as a list of fixed strings, separated
579 by newlines, any of which is to be matched.
583 In addition, two variant programs @sc{egrep} and @sc{fgrep} are available.
584 @sc{egrep} is the same as @samp{grep -E}. @sc{fgrep} is the
585 same as @samp{grep -F}.
587 @node Regular Expressions
588 @chapter Regular Expressions
589 @cindex regular expressions
591 A @dfn{regular expression} is a pattern that describes a set of strings.
592 Regular expressions are constructed analogously to arithmetic expressions,
593 by using various operators to combine smaller expressions.
594 @command{grep} understands two different versions of regular expression
595 syntax: ``basic'' and ``extended''. In @sc{gnu} @command{grep}, there is no
596 difference in available functionality using either syntax.
597 In other implementations, basic regular expressions are less powerful.
598 The following description applies to extended regular expressions;
599 differences for basic regular expressions are summarized afterwards.
601 The fundamental building blocks are the regular expressions that match
602 a single character. Most characters, including all letters and digits,
603 are regular expressions that match themselves. Any metacharacter
604 with special meaning may be quoted by preceding it with a backslash.
605 A list of characters enclosed by @samp{[} and @samp{]} matches any
606 single character in that list; if the first character of the list is the
607 caret @samp{^}, then it
608 matches any character @strong{not} in the list. For example, the regular
609 expression @samp{[0123456789]} matches any single digit.
610 A range of characters may be specified by giving the first
611 and last characters, separated by a hyphen.
613 Finally, certain named classes of characters are predefined, as follows.
614 Their interpretation depends on the @code{LC_CTYPE} locale; the
615 interpretation below is that of the @sc{posix} locale, which is the default
616 if no @code{LC_CTYPE} locale is specified.
618 @cindex classes of characters
619 @cindex character classes
624 @cindex alphanumeric characters
625 Alphanumeric characters:
626 @samp{[:alpha:]} and @samp{[:digit:]}.
630 @cindex alphabetic characters
631 Alphabetic characters:
632 @samp{[:lower:]} and @samp{[:upper:]}.
636 @cindex blank characters
642 @cindex control characters
643 Control characters. In @sc{ascii}, these characters have octal codes 000
644 through 037, and 177 (@code{DEL}). In other character sets, these are
645 the equivalent characters, if any.
649 @cindex digit characters
650 @cindex numeric characters
651 Digits: @code{0 1 2 3 4 5 6 7 8 9}.
655 @cindex graphic characters
656 Graphical characters:
657 @samp{[:alnum:]} and @samp{[:punct:]}.
661 @cindex lower-case letters
663 @code{a b c d e f g h i j k l m n o p q r s t u v w x y z}.
667 @cindex printable characters
668 Printable characters:
669 @samp{[:alnum:]}, @samp{[:punct:]}, and space.
673 @cindex punctuation characters
674 Punctuation characters:
675 @code{!@: " # $ % & ' ( ) * + , - .@: / : ; < = > ?@: @@ [ \ ] ^ _ ` @{ | @} ~}.
679 @cindex space characters
680 @cindex whitespace characters
682 tab, newline, vertical tab, form feed, carriage return, and space.
686 @cindex upper-case letters
688 @code{A B C D E F G H I J K L M N O P Q R S T U V W X Y Z}.
693 @cindex hexadecimal digits
695 @code{0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f}.
698 For example, @samp{[[:alnum:]]} means @samp{[0-9A-Za-z]}, except the latter
699 depends upon the @sc{posix} locale and the @sc{ascii} character
700 encoding, whereas the former is independent of locale and character set.
701 (Note that the brackets in these class names are
702 part of the symbolic names, and must be included in addition to
703 the brackets delimiting the bracket list.) Most metacharacters lose
704 their special meaning inside lists. To include a literal @samp{]}, place it
705 first in the list. Similarly, to include a literal @samp{^}, place it anywhere
706 but first. Finally, to include a literal @samp{-}, place it last.
708 The period @samp{.} matches any single character. The symbol @samp{\w}
709 is a synonym for @samp{[[:alnum:]]} and @samp{\W} is a synonym for
712 The caret @samp{^} and the dollar sign @samp{$} are metacharacters that
713 respectively match the empty string at the beginning and end
714 of a line. The symbols @samp{\<} and @samp{\>} respectively match the
715 empty string at the beginning and end of a word. The symbol
716 @samp{\b} matches the empty string at the edge of a word, and @samp{\B}
717 matches the empty string provided it's not at the edge of a word.
719 A regular expression may be followed by one of several
720 repetition operators:
727 @cindex question mark
728 @cindex match sub-expression at most once
729 The preceding item is optional and will be matched at most once.
734 @cindex match sub-expression zero or more times
735 The preceding item will be matched zero or more times.
740 The preceding item will be matched one or more times.
744 @cindex braces, one argument
745 @cindex match sub-expression n times
746 The preceding item is matched exactly @var{n} times.
750 @cindex braces, second argument omitted
751 @cindex match sub-expression n or more times
752 The preceding item is matched n or more times.
754 @item @{@var{n},@var{m}@}
756 @cindex braces, two arguments
757 The preceding item is matched at least @var{n} times, but not more than
762 Two regular expressions may be concatenated; the resulting regular
763 expression matches any string formed by concatenating two substrings
764 that respectively match the concatenated subexpressions.
766 Two regular expressions may be joined by the infix operator @samp{|}; the
767 resulting regular expression matches any string matching either
770 Repetition takes precedence over concatenation, which in turn
771 takes precedence over alternation. A whole subexpression may be
772 enclosed in parentheses to override these precedence rules.
774 The backreference @samp{\@var{n}}, where @var{n} is a single digit, matches the
775 substring previously matched by the @var{n}th parenthesized subexpression
776 of the regular expression.
778 @cindex basic regular expressions
779 In basic regular expressions the metacharacters @samp{?}, @samp{+},
780 @samp{@{}, @samp{|}, @samp{(}, and @samp{)} lose their special meaning;
781 instead use the backslashed versions @samp{\?}, @samp{\+}, @samp{\@{},
782 @samp{\|}, @samp{\(}, and @samp{\)}.
784 @cindex interval specifications
785 Traditional @command{egrep} did not support the @samp{@{} metacharacter,
786 and some @command{egrep} implementations support @samp{\@{} instead, so
787 portable scripts should avoid @samp{@{} in @samp{egrep} patterns and
788 should use @samp{[@{]} to match a literal @samp{@{}.
790 @sc{gnu} @command{egrep} attempts to support traditional usage by
791 assuming that @samp{@{} is not special if it would be the start of an
792 invalid interval specification. For example, the shell command
793 @samp{egrep '@{1'} searches for the two-character string @samp{@{1}
794 instead of reporting a syntax error in the regular expression.
795 @sc{posix.2} allows this behavior as an extension, but portable scripts
801 @cindex Usage, examples
802 Here is an example shell command that invokes @sc{gnu} @command{grep}:
805 grep -i 'hello.*world' menu.h main.c
809 This lists all lines in the files @file{menu.h} and @file{main.c} that
810 contain the string @samp{hello} followed by the string @samp{world};
811 this is because @samp{.*} matches zero or more characters within a line.
812 @xref{Regular Expressions}. The @samp{-i} option causes @command{grep}
813 to ignore case, causing it to match the line @samp{Hello, world!}, which
814 it would not otherwise match. @xref{Invoking}, for more details about
815 how to invoke @command{grep}.
817 @cindex Using @command{grep}, Q&A
818 @cindex FAQ about @command{grep} usage
819 Here are some common questions and answers about @command{grep} usage.
824 How can I list just the names of matching files?
831 lists the names of all C files in the current directory whose contents
835 How do I search directories recursively?
838 grep -r 'hello' /home/gigi
842 searches for @samp{hello} in all files under the directory
843 @file{/home/gigi}. For more control of which files are searched, use
844 @command{find}, @command{grep} and @command{xargs}. For example,
845 the following command searches only C files:
848 find /home/gigi -name '*.c' -print | xargs grep 'hello' /dev/null
852 What if a pattern has a leading @samp{-}?
855 grep -e '--cut here--' *
859 searches for all lines matching @samp{--cut here--}. Without @samp{-e},
860 @command{grep} would attempt to parse @samp{--cut here--} as a list of
864 Suppose I want to search for a whole word, not a part of a word?
871 searches only for instances of @samp{hello} that are entire words; it
872 does not match @samp{Othello}. For more control, use @samp{\<} and
873 @samp{\>} to match the start and end of words. For example:
880 searches only for words ending in @samp{hello}, so it matches the word
884 How do I output context around the matching lines?
891 prints two lines of context around each matching line.
894 How do I force grep to print the name of the file?
896 Append @file{/dev/null}:
899 grep 'eli' /etc/passwd /dev/null
903 Why do people use strange regular expressions on @command{ps} output?
906 ps -ef | grep '[c]ron'
909 If the pattern had been written without the square brackets, it would
910 have matched not only the @command{ps} output line for @command{cron},
911 but also the @command{ps} output line for @command{grep}.
914 Why does @command{grep} report ``Binary file matches''?
916 If @command{grep} listed all matching ``lines'' from a binary file, it
917 would probably generate output that is not useful, and it might even
918 muck up your display. So @sc{gnu} @command{grep} suppresses output from
919 files that appear to be binary files. To force @sc{gnu} @command{grep}
920 to output lines even from files that appear to be binary, use the
921 @samp{-a} or @samp{--binary-files=text} option. To eliminate the
922 ``Binary file matches'' messages, use the @samp{-I} or
923 @samp{--binary-files=without-match} option.
926 Why doesn't @samp{grep -lv} print nonmatching file names?
928 @samp{grep -lv} lists the names of all files containing one or more
929 lines that do not match. To list the names of all files that contain no
930 matching lines, use the @samp{-L} or @samp{--files-without-match}
934 I can do @sc{or} with @samp{|}, but what about @sc{and}?
937 grep 'paul' /etc/motd | grep 'franc,ois'
941 finds all lines that contain both @samp{paul} and @samp{franc,ois}.
944 How can I search in both standard input and in files?
946 Use the special file name @samp{-}:
949 cat /etc/passwd | grep 'alain' - /etc/motd
954 @chapter Reporting bugs
956 @cindex Bugs, reporting
957 Email bug reports to @email{bug-gnu-utils@@gnu.org}.
958 Be sure to include the word ``grep'' somewhere in the ``Subject:'' field.
960 Large repetition counts in the @samp{@{m,n@}} construct may cause
961 @command{grep} to use lots of memory. In addition, certain other
962 obscure regular expressions require exponential time and
963 space, and may cause grep to run out of memory.
964 Backreferences are very slow, and may require exponential time.
968 @unnumbered Concept Index
970 This is a general index of all issues discussed in this manual, with the
971 exception of the @command{grep} commands and command-line options.
979 This is an alphabetical list of all @command{grep} commands, command-line
980 options, and environment variables.