--- doc/grep.texi.new 2005-11-10 19:51:28.000000000 +0100 +++ doc/grep.texi 2005-11-10 19:52:06.000000000 +0100 @@ -135,6 +135,8 @@ @command{grep} comes with a rich set of options from @sc{posix.2} and @sc{gnu} extensions. address@hidden @sc{posix} Options + @table @samp @item -c @@ -248,6 +250,15 @@ @cindex context lines, after match Print @var{num} lines of trailing context after matching lines. address@hidden -a address@hidden --text address@hidden -a address@hidden --text address@hidden suppress binary data address@hidden binary files +Process a binary file as if it were text; this is equivalent to the address@hidden option. + @item -B @var{num} @itemx address@hidden @opindex -B @@ -256,6 +267,33 @@ @cindex context lines, before match Print @var{num} lines of leading context before matching lines. address@hidden -b address@hidden --byte-offset address@hidden -b address@hidden --byte-offset address@hidden byte offset +Print the byte offset within the input file before each line of output. +When @command{grep} runs on @sc{ms-dos} or MS-Windows, the printed +byte offsets +depend on whether the @samp{-u} (@samp{--unix-byte-offsets}) option is +used; see below. + address@hidden address@hidden address@hidden --binary-files address@hidden binary files +If the first few bytes of a file indicate that the file contains binary +data, assume that the file is of type @var{type}. By default, address@hidden is @samp{binary}, and @command{grep} normally outputs either +a one-line message saying that a binary file matches, or no message if +there is no match. If @var{type} is @samp{without-match}, address@hidden assumes that a binary file does not match; +this is equivalent to the @samp{-I} option. If @var{type} +is @samp{text}, @command{grep} processes a binary file as if it were +text; this is equivalent to the @samp{-a} option. address@hidden:} @samp{--binary-files=text} might output binary garbage, +which can have nasty side effects if the output is a terminal and if the +terminal driver interprets some of it as commands. + @item -C @var{num} @itemx address@hidden @opindex -C @@ -263,6 +301,11 @@ @cindex context Print @var{num} lines of output context. address@hidden address@hidden address@hidden -NUM +Same as @address@hidden lines of leading and trailing +context. However, @command{grep} will never print any given line more than once. + @item address@hidden @itemx address@hidden @opindex --color @@ -281,52 +324,6 @@ which only covers the color for matched text. @var{WHEN} is `never', `always', or `auto'. address@hidden address@hidden address@hidden -NUM -Same as @address@hidden lines of leading and trailing -context. However, @command{grep} will never print any given line more than once. - address@hidden -V address@hidden --version address@hidden -V address@hidden --version address@hidden Version, printing -Print the version number of @command{grep} to the standard output stream. -This version number should be included in all bug reports. - address@hidden --help address@hidden --help address@hidden Usage summary, printing -Print a usage message briefly summarizing these command-line options -and the bug-reporting address, then exit. - address@hidden address@hidden address@hidden --binary-files address@hidden binary files -If the first few bytes of a file indicate that the file contains binary -data, assume that the file is of type @var{type}. By default, address@hidden is @samp{binary}, and @command{grep} normally outputs either -a one-line message saying that a binary file matches, or no message if -there is no match. If @var{type} is @samp{without-match}, address@hidden assumes that a binary file does not match; -this is equivalent to the @samp{-I} option. If @var{type} -is @samp{text}, @command{grep} processes a binary file as if it were -text; this is equivalent to the @samp{-a} option. address@hidden:} @samp{--binary-files=text} might output binary garbage, -which can have nasty side effects if the output is a terminal and if the -terminal driver interprets some of it as commands. - address@hidden -b address@hidden --byte-offset address@hidden -b address@hidden --byte-offset address@hidden byte offset -Print the byte offset within the input file before each line of output. -When @command{grep} runs on @sc{ms-dos} or MS-Windows, the printed -byte offsets -depend on whether the @samp{-u} (@samp{--unix-byte-offsets}) option is -used; see below. - @item -D @var{action} @itemx address@hidden @opindex -D @@ -352,6 +349,13 @@ @samp{recurse}, @command{grep} reads all files under each directory, recursively; this is equivalent to the @samp{-r} option. address@hidden address@hidden address@hidden --exclude address@hidden exclude files address@hidden searching directory trees +Skip files matching @var{file_pattern} +(using wildcard matching). + @item -H @itemx --with-filename @opindex -H @@ -366,64 +370,16 @@ @cindex no filename prefix Suppress the prefixing of filenames on output when multiple files are searched. address@hidden --line-buffered address@hidden --line-buffered address@hidden line buffering -Set the line buffering policy, this can be a performance penalty. - address@hidden address@hidden address@hidden --label address@hidden changing name of standard input -Display input actually coming from standard input as input coming from file address@hidden This is especially useful for tools like @command{zgrep}, e.g., address@hidden -cd foo.gz | grep --label=foo something} - address@hidden -L address@hidden --files-without-match address@hidden -L address@hidden --files-without-match address@hidden files which don't match -Suppress normal output; instead print the name of each input -file from which no output would normally have been printed. -The scanning of every file will stop on the first match. - address@hidden -a address@hidden --text address@hidden -a address@hidden --text address@hidden suppress binary data address@hidden binary files -Process a binary file as if it were text; this is equivalent to the address@hidden option. address@hidden --help address@hidden --help address@hidden Usage summary, printing +Print a usage message briefly summarizing these command-line options +and the bug-reporting address, then exit. @item -I Process a binary file as if it did not contain matching data; this is equivalent to the @samp{--binary-files=without-match} option. address@hidden -w address@hidden --word-regexp address@hidden -w address@hidden --word-regexp address@hidden matching whole words -Select only those lines containing matches that form -whole words. The test is that the matching substring -must either be at the beginning of the line, or preceded -by a non-word constituent character. Similarly, -it must be either at the end of the line or followed by -a non-word constituent character. Word-constituent -characters are letters, digits, and the underscore. - address@hidden -r address@hidden -R address@hidden --recursive address@hidden -r address@hidden --recursive address@hidden recursive search address@hidden searching directory trees -For each directory mentioned in the command line, read and process all -files in that directory, recursively. This is the same as the address@hidden option. - @item address@hidden @opindex --include @cindex include files @@ -431,12 +387,26 @@ Search only files matching @var{file_pattern} (using wildcard matching). address@hidden address@hidden address@hidden --exclude address@hidden exclude files address@hidden searching directory trees -Skip files matching @var{file_pattern} -(using wildcard matching). address@hidden -L address@hidden --files-without-match address@hidden -L address@hidden --files-without-match address@hidden files which don't match +Suppress normal output; instead print the name of each input +file from which no output would normally have been printed. +The scanning of every file will stop on the first match. + address@hidden address@hidden address@hidden --label address@hidden changing name of standard input +Display input actually coming from standard input as input coming from file address@hidden This is especially useful for tools like @command{zgrep}, e.g., address@hidden -cd foo.gz | grep --label=foo something} + address@hidden --line-buffered address@hidden --line-buffered address@hidden line buffering +Set the line buffering policy; this can be a performance penalty. @item -m @var{num} @itemx address@hidden @@ -479,10 +449,41 @@ also used, @command{grep} stops after outputting @var{num} non-matching lines. address@hidden -y address@hidden -y address@hidden case insensitive search, obsolete option -Obsolete synonym for @samp{-i}. address@hidden --mmap address@hidden --mmap address@hidden memory mapped input +If possible, use the @code{mmap} system call to read input, instead of +the default @code{read} system call. In some situations, @samp{--mmap} +yields better performance. However, @samp{--mmap} can cause undefined +behavior (including core dumps) if an input file shrinks while address@hidden is operating, or if an I/O error occurs. + address@hidden -r address@hidden -R address@hidden --recursive address@hidden -r address@hidden --recursive address@hidden recursive search address@hidden searching directory trees +For each directory mentioned in the command line, read and process all +files in that directory, recursively. This is the same as the address@hidden option. + address@hidden -T address@hidden --initial-tab address@hidden -T address@hidden --initial-tab address@hidden tab-aligned content lines +Makes sure that the first character of actual line content lies on a +tab stop, so that the alignment of tabs looks normal. +This is useful when combined with @samp{-H} (which is implicit when +there is more than one file to search), @samp{-n}, and @samp{-b}; +these options prepend their output at the beginning of the displayed +line, before the actual content. +In order to improve the probability that all matched or context lines +from a single file will all start at the same column, this also causes +the line number and octet offset (if present) to be printed in a minimum +size field width. @item -U @itemx --binary @@ -517,30 +518,31 @@ option is also used; it has no effect on platforms other than @sc{ms-dos} and MS-Windows. address@hidden --mmap address@hidden --mmap address@hidden memory mapped input -If possible, use the @code{mmap} system call to read input, instead of -the default @code{read} system call. In some situations, @samp{--mmap} -yields better performance. However, @samp{--mmap} can cause undefined -behavior (including core dumps) if an input file shrinks while address@hidden is operating, or if an I/O error occurs. address@hidden -V address@hidden --version address@hidden -V address@hidden --version address@hidden Version, printing +Print the version number of @command{grep} to the standard output stream. +This version number should be included in all bug reports. address@hidden -T address@hidden --initial-tab address@hidden -T address@hidden --initial-tab address@hidden tab-aligned content lines -Makes sure that the first character of actual line content lies on a -tab stop, so that the alignment of tabs looks normal. -This is useful when combined with @samp{-H} (which is implicit when -there is more than one file to search), @samp{-n}, and @samp{-b}; -these options prepend their output at the beginning of the displayed -line, before the actual content. -In order to improve the probability that all matched or context lines -from a single file will all start at the same column, this also causes -the line number and octet offset (if present) to be printed in a minimum -size field width. address@hidden -w address@hidden --word-regexp address@hidden -w address@hidden --word-regexp address@hidden matching whole words +Select only those lines containing matches that form +whole words. The test is that the matching substring +must either be at the beginning of the line, or preceded +by a non-word constituent character. Similarly, +it must be either at the end of the line or followed by +a non-word constituent character. Word-constituent +characters are letters, digits, and the underscore. + address@hidden -y address@hidden -y address@hidden case insensitive search, obsolete option +Obsolete synonym for @samp{-i}. @item -Z @itemx --null --- doc/grep.1.new 2005-11-10 19:49:53.000000000 +0100 +++ doc/grep.1 2005-11-10 19:52:06.000000000 +0100 @@ -134,6 +134,13 @@ which can have nasty side effects if the output is a terminal and if the terminal driver interprets some of it as commands. .TP +.BR \-c ", " \-\^\-count +Suppress normal output; instead print a count of +matching lines for each input file. +With the +.BR \-v ", " \-\^\-invert-match +option (see below), count non-matching lines. +.TP .BI \-\^\-color[=\fIWHEN\fR] ", " \-\^\-colour[=\fIWHEN\fR] Surround the matching non-empty strings, matching lines, context lines, file names, line numbers, octet offsets, and separators (for fields and @@ -147,13 +154,6 @@ .I WHEN is `never', `always', or `auto'. .TP -.BR \-c ", " \-\^\-count -Suppress normal output; instead print a count of -matching lines for each input file. -With the -.BR \-v ", " \-\^\-invert-match -option (see below), count non-matching lines. -.TP .BI \-D " ACTION" "\fR,\fP \-\^\-devices=" ACTION If an input file is a device, FIFO or socket, use .I ACTION