Charles Levert wrote:
> Here is a tentative patch. Please search
> through both files and try to find any remaining
> similar formulations that I may have missed,
I've found no other such formulations. But looking closely at the
text, I did find some unquoted occurrences of `grep', and a few
spelling and wording errors. The first patch fixes these, plus an
example that doesn't make sense.
The second patch adds the "(using wildcard matching)" also to the
explanation of `--include'. It removes the "and directories", to
make the text describe the actual behaviour of grep.
The third patch applies after the first two; it reorders the GNU
options alphabetically.
Benno
--- doc/grep.texi.old 2005-11-10 19:24:03.000000000 +0100
+++ doc/grep.texi 2005-11-10 19:43:50.000000000 +0100
@@ -284,7 +284,7 @@
@item [EMAIL PROTECTED]
@opindex -NUM
Same as @[EMAIL PROTECTED] lines of leading and trailing
-context. However, grep will never print any given line more than once.
+context. However, @command{grep} will never print any given line more than once.
@item -V
@itemx --version
@@ -510,8 +510,8 @@
@opindex --unix-byte-offsets
@cindex DOS byte offsets
@cindex byte offsets, on DOS/Windows
-Report Unix-style byte offsets. This switch causes
[EMAIL PROTECTED] to report byte offsets as if the file were Unix style
+Report Unix-style byte offsets. This option causes
[EMAIL PROTECTED] to report byte offsets as if the file were a Unix-style
text file, i.e., the byte offsets ignore the @code{CR} characters which were
stripped. This will produce results identical to running @command{grep} on
a Unix machine. This option has no effect unless @samp{-b}
@@ -1024,8 +1024,7 @@
@end table
For example , @samp{\brat\b} matches the separate word @samp{rat},
[EMAIL PROTECTED] matches @samp{crate}, but @samp{dirty \Brat} doesn't
-match @samp{dirty rat}.
[EMAIL PROTECTED] matches @samp{crate} but not @samp{furry rat}.
@section Anchoring
@cindex anchoring
@@ -1039,10 +1038,10 @@
The back-reference @[EMAIL PROTECTED], where @var{n} is a single digit, matches
the substring previously matched by the @var{n}th parenthesized subexpression
of the regular expression. For example, @samp{(a)\1} matches @samp{aa}.
-When use with alternation if the group does not participate in the match, then
+When used with alternation, if the group does not participate in the match then
the back-reference makes the whole match fail. For example, @samp{a(.)|b\1}
will not match @samp{ba}. When multiple regular expressions are given with
[EMAIL PROTECTED] or from a file @samp{-f file}, the back-referecences are local to
[EMAIL PROTECTED] or from a file (@samp{-f file}), the back-references are local to
each expression.
@section Basic vs Extended
@@ -1112,7 +1111,7 @@
@noindent
searches for @samp{hello} in all files under the directory
[EMAIL PROTECTED]/home/gigi}. For more control of which files are searched, use
[EMAIL PROTECTED]/home/gigi}. For more control over which files are searched, use
@command{find}, @command{grep} and @command{xargs}. For example,
the following command searches only C files:
@@ -1174,7 +1173,7 @@
prints two lines of context around each matching line.
@item
-How do I force grep to print the name of the file?
+How do I force @command{grep} to print the name of the file?
Append @file{/dev/null}:
@@ -1198,8 +1197,8 @@
If the pattern had been written without the square brackets, it would
have matched not only the @command{ps} output line for @command{cron},
but also the @command{ps} output line for @command{grep}.
-Note that some platforms @command{ps} limit the ouput to the width
-of the screen, grep does not have any limit on the length of a line
+Note that on some platforms @command{ps} limits the output to the width
+of the screen; @command{grep} does not have any limit on the length of a line
except the available memory.
@item
@@ -1245,8 +1244,8 @@
@cindex palindromes
How to express palindromes in a regular expression?
-It can be done by using the back referecences, for example a palindrome
-of 4 chararcters can be written in BRE.
+It can be done by using back-references; for example, a palindrome
+of 4 characters can be written with a BRE:
@example
grep -w -e '\(.\)\(.\).\2\1' file
@@ -1255,14 +1254,14 @@
It matches the word "radar" or "civic".
Guglielmo Bondioni proposed a single RE that finds all the palindromes up to 19
-characters long.
+characters long:
@example
grep -E -e '^(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?).?\9\8\7\6\5\4\3\2\1$' file
@end example
-Note this is done by using GNU ERE extensions, it might not be portable on
-other greps.
+Note this is done by using GNU ERE extensions; it might not be portable to
+other implementations of @command{grep}.
@item
Why is this back-reference failing?
@@ -1303,7 +1302,7 @@
Large repetition counts in the @[EMAIL PROTECTED],[EMAIL PROTECTED] construct may cause
@command{grep} to use lots of memory. In addition, certain other
obscure regular expressions require exponential time and
-space, and may cause grep to run out of memory.
+space, and may cause @command{grep} to run out of memory.
Back-references are very slow, and may require exponential time.
@node Copying, GNU General Public License, Reporting Bugs, Top
--- doc/grep.1.old 2005-11-10 19:18:11.000000000 +0100
+++ doc/grep.1 2005-11-10 19:49:53.000000000 +0100
@@ -203,7 +203,9 @@
.BR \- .
.TP
.BI \-\^\-exclude= FILE_PATTERN
-.RI "Skip files " "and directories" " that match " FILE_PATTERN.
+Skip files that match
+.I FILE_PATTERN
+(using wildcard matching).
.TP
.BR \-F ", " \-\^\-fixed-strings
Interpret
--- doc/grep.texi.old 2005-11-10 19:24:03.000000000 +0100
+++ doc/grep.texi 2005-11-10 19:47:55.000000000 +0100
@@ -428,13 +428,15 @@
@opindex --include
@cindex include files
@cindex searching directory trees
-Search only files matching @var{file_pattern}.
+Search only files matching @var{file_pattern}
+(using wildcard matching).
@item [EMAIL PROTECTED]
@opindex --exclude
@cindex exclude files
@cindex searching directory trees
-Skip files @emph{and directories} matching @var{file_pattern}.
+Skip files matching @var{file_pattern}
+(using wildcard matching).
@item -m @var{num}
@itemx [EMAIL PROTECTED]
--- 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.
[EMAIL PROTECTED] @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.
[EMAIL PROTECTED] -a
[EMAIL PROTECTED] --text
[EMAIL PROTECTED] -a
[EMAIL PROTECTED] --text
[EMAIL PROTECTED] suppress binary data
[EMAIL PROTECTED] binary files
+Process a binary file as if it were text; this is equivalent to the
[EMAIL PROTECTED] option.
+
@item -B @var{num}
@itemx [EMAIL PROTECTED]
@opindex -B
@@ -256,6 +267,33 @@
@cindex context lines, before match
Print @var{num} lines of leading context before matching lines.
[EMAIL PROTECTED] -b
[EMAIL PROTECTED] --byte-offset
[EMAIL PROTECTED] -b
[EMAIL PROTECTED] --byte-offset
[EMAIL PROTECTED] 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.
+
[EMAIL PROTECTED] [EMAIL PROTECTED]
[EMAIL PROTECTED] --binary-files
[EMAIL PROTECTED] 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,
[EMAIL PROTECTED] 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},
[EMAIL PROTECTED] 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.
[EMAIL PROTECTED]:} @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 [EMAIL PROTECTED]
@opindex -C
@@ -263,6 +301,11 @@
@cindex context
Print @var{num} lines of output context.
[EMAIL PROTECTED] [EMAIL PROTECTED]
[EMAIL PROTECTED] -NUM
+Same as @[EMAIL PROTECTED] lines of leading and trailing
+context. However, @command{grep} will never print any given line more than once.
+
@item [EMAIL PROTECTED]
@itemx [EMAIL PROTECTED]
@opindex --color
@@ -281,52 +324,6 @@
which only covers the color for matched text.
@var{WHEN} is `never', `always', or `auto'.
[EMAIL PROTECTED] [EMAIL PROTECTED]
[EMAIL PROTECTED] -NUM
-Same as @[EMAIL PROTECTED] lines of leading and trailing
-context. However, @command{grep} will never print any given line more than once.
-
[EMAIL PROTECTED] -V
[EMAIL PROTECTED] --version
[EMAIL PROTECTED] -V
[EMAIL PROTECTED] --version
[EMAIL PROTECTED] Version, printing
-Print the version number of @command{grep} to the standard output stream.
-This version number should be included in all bug reports.
-
[EMAIL PROTECTED] --help
[EMAIL PROTECTED] --help
[EMAIL PROTECTED] Usage summary, printing
-Print a usage message briefly summarizing these command-line options
-and the bug-reporting address, then exit.
-
[EMAIL PROTECTED] [EMAIL PROTECTED]
[EMAIL PROTECTED] --binary-files
[EMAIL PROTECTED] 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,
[EMAIL PROTECTED] 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},
[EMAIL PROTECTED] 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.
[EMAIL PROTECTED]:} @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.
-
[EMAIL PROTECTED] -b
[EMAIL PROTECTED] --byte-offset
[EMAIL PROTECTED] -b
[EMAIL PROTECTED] --byte-offset
[EMAIL PROTECTED] 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 [EMAIL PROTECTED]
@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.
[EMAIL PROTECTED] [EMAIL PROTECTED]
[EMAIL PROTECTED] --exclude
[EMAIL PROTECTED] exclude files
[EMAIL PROTECTED] 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.
[EMAIL PROTECTED] --line-buffered
[EMAIL PROTECTED] --line-buffered
[EMAIL PROTECTED] line buffering
-Set the line buffering policy, this can be a performance penalty.
-
[EMAIL PROTECTED] [EMAIL PROTECTED]
[EMAIL PROTECTED] --label
[EMAIL PROTECTED] changing name of standard input
-Display input actually coming from standard input as input coming from file
[EMAIL PROTECTED] This is especially useful for tools like @command{zgrep}, e.g.,
[EMAIL PROTECTED] -cd foo.gz | grep --label=foo something}
-
[EMAIL PROTECTED] -L
[EMAIL PROTECTED] --files-without-match
[EMAIL PROTECTED] -L
[EMAIL PROTECTED] --files-without-match
[EMAIL PROTECTED] 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.
-
[EMAIL PROTECTED] -a
[EMAIL PROTECTED] --text
[EMAIL PROTECTED] -a
[EMAIL PROTECTED] --text
[EMAIL PROTECTED] suppress binary data
[EMAIL PROTECTED] binary files
-Process a binary file as if it were text; this is equivalent to the
[EMAIL PROTECTED] option.
[EMAIL PROTECTED] --help
[EMAIL PROTECTED] --help
[EMAIL PROTECTED] 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.
[EMAIL PROTECTED] -w
[EMAIL PROTECTED] --word-regexp
[EMAIL PROTECTED] -w
[EMAIL PROTECTED] --word-regexp
[EMAIL PROTECTED] 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.
-
[EMAIL PROTECTED] -r
[EMAIL PROTECTED] -R
[EMAIL PROTECTED] --recursive
[EMAIL PROTECTED] -r
[EMAIL PROTECTED] --recursive
[EMAIL PROTECTED] recursive search
[EMAIL PROTECTED] 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
[EMAIL PROTECTED] option.
-
@item [EMAIL PROTECTED]
@opindex --include
@cindex include files
@@ -431,12 +387,26 @@
Search only files matching @var{file_pattern}
(using wildcard matching).
[EMAIL PROTECTED] [EMAIL PROTECTED]
[EMAIL PROTECTED] --exclude
[EMAIL PROTECTED] exclude files
[EMAIL PROTECTED] searching directory trees
-Skip files matching @var{file_pattern}
-(using wildcard matching).
[EMAIL PROTECTED] -L
[EMAIL PROTECTED] --files-without-match
[EMAIL PROTECTED] -L
[EMAIL PROTECTED] --files-without-match
[EMAIL PROTECTED] 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.
+
[EMAIL PROTECTED] [EMAIL PROTECTED]
[EMAIL PROTECTED] --label
[EMAIL PROTECTED] changing name of standard input
+Display input actually coming from standard input as input coming from file
[EMAIL PROTECTED] This is especially useful for tools like @command{zgrep}, e.g.,
[EMAIL PROTECTED] -cd foo.gz | grep --label=foo something}
+
[EMAIL PROTECTED] --line-buffered
[EMAIL PROTECTED] --line-buffered
[EMAIL PROTECTED] line buffering
+Set the line buffering policy; this can be a performance penalty.
@item -m @var{num}
@itemx [EMAIL PROTECTED]
@@ -479,10 +449,41 @@
also used, @command{grep} stops after outputting @var{num}
non-matching lines.
[EMAIL PROTECTED] -y
[EMAIL PROTECTED] -y
[EMAIL PROTECTED] case insensitive search, obsolete option
-Obsolete synonym for @samp{-i}.
[EMAIL PROTECTED] --mmap
[EMAIL PROTECTED] --mmap
[EMAIL PROTECTED] 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
[EMAIL PROTECTED] is operating, or if an I/O error occurs.
+
[EMAIL PROTECTED] -r
[EMAIL PROTECTED] -R
[EMAIL PROTECTED] --recursive
[EMAIL PROTECTED] -r
[EMAIL PROTECTED] --recursive
[EMAIL PROTECTED] recursive search
[EMAIL PROTECTED] 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
[EMAIL PROTECTED] option.
+
[EMAIL PROTECTED] -T
[EMAIL PROTECTED] --initial-tab
[EMAIL PROTECTED] -T
[EMAIL PROTECTED] --initial-tab
[EMAIL PROTECTED] 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.
[EMAIL PROTECTED] --mmap
[EMAIL PROTECTED] --mmap
[EMAIL PROTECTED] 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
[EMAIL PROTECTED] is operating, or if an I/O error occurs.
[EMAIL PROTECTED] -V
[EMAIL PROTECTED] --version
[EMAIL PROTECTED] -V
[EMAIL PROTECTED] --version
[EMAIL PROTECTED] Version, printing
+Print the version number of @command{grep} to the standard output stream.
+This version number should be included in all bug reports.
[EMAIL PROTECTED] -T
[EMAIL PROTECTED] --initial-tab
[EMAIL PROTECTED] -T
[EMAIL PROTECTED] --initial-tab
[EMAIL PROTECTED] 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.
[EMAIL PROTECTED] -w
[EMAIL PROTECTED] --word-regexp
[EMAIL PROTECTED] -w
[EMAIL PROTECTED] --word-regexp
[EMAIL PROTECTED] 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.
+
[EMAIL PROTECTED] -y
[EMAIL PROTECTED] -y
[EMAIL PROTECTED] 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