summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2021-06-10 14:55:21 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2021-06-10 14:55:43 -0700
commite6571dfd459f55de975ef457cf7dbd4b49ec491c (patch)
treeb0deb48f3c7898ec37af437aff06047c41446131 /doc
parent70517057c9234146d56bb05cc22cd62ab6407c86 (diff)
downloadgrep-e6571dfd459f55de975ef457cf7dbd4b49ec491c.tar.gz
doc: improve examples and wording
* doc/grep.texi (The Backslash Character and Special Expressions) (Usage): Improve doc (Bug#48948).
Diffstat (limited to 'doc')
-rw-r--r--doc/grep.texi17
1 files changed, 8 insertions, 9 deletions
diff --git a/doc/grep.texi b/doc/grep.texi
index e3b1555b..01ac81e8 100644
--- a/doc/grep.texi
+++ b/doc/grep.texi
@@ -1479,10 +1479,10 @@ Match the empty string at the edge of a word.
Match the empty string provided it's not at the edge of a word.
@item \<
-Match the empty string at the beginning of word.
+Match the empty string at the beginning of a word.
@item \>
-Match the empty string at the end of word.
+Match the empty string at the end of a word.
@item \w
Match word constituent, it is a synonym for @samp{[_[:alnum:]]}.
@@ -1667,23 +1667,22 @@ The @option{-i} option causes @command{grep}
to ignore case, causing it to match the line @samp{Hello, world!}, which
it would not otherwise match.
-Here is a more complex example session,
+Here is a more complex example,
showing the location and contents of any line
containing @samp{f} and ending in @samp{.c},
within all files in the current directory whose names
-contain @samp{g} and end in @samp{.h}.
+start with non-@samp{.}, contain @samp{g}, and end in @samp{.h}.
The @option{-n} option outputs line numbers, the @option{--} argument
-treats any later arguments starting with @samp{-} as file names not
-options, and the empty file @file{/dev/null} causes file names to be output
+treats any later arguments as file names not options even if
+@code{*g*.h} expands to a file name that starts with @samp{-},
+and the empty file @file{/dev/null} causes file names to be output
even if only one file name happens to be of the form @samp{*g*.h}.
@example
-$ @kbd{grep -n -- 'f.*\.c$' *g*.h /dev/null}
-argmatch.h:1:/* definitions and prototypes for argmatch.c
+grep -n -- 'f.*\.c$' *g*.h /dev/null
@end example
@noindent
-The only line that contains a match is line 1 of @file{argmatch.h}.
Note that the regular expression syntax used in the pattern differs
from the globbing syntax that the shell uses to match file names.