--- 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 address@hidden @opindex -NUM Same as @address@hidden 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 address@hidden to report byte offsets as if the file were Unix style +Report Unix-style byte offsets. This option causes address@hidden 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}, address@hidden matches @samp{crate}, but @samp{dirty \Brat} doesn't -match @samp{dirty rat}. address@hidden matches @samp{crate} but not @samp{furry rat}. @section Anchoring @cindex anchoring @@ -1039,10 +1038,10 @@ The back-reference @address@hidden, 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 address@hidden or from a file @samp{-f file}, the back-referecences are local to address@hidden 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 address@hidden/home/gigi}. For more control of which files are searched, use address@hidden/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 @address@hidden,address@hidden 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