summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2019-12-29 18:57:28 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2019-12-29 18:58:24 -0800
commita517df5bd51e68c1290ec596b87e8fbe7a381279 (patch)
treecccfd3fa61ab14ba8de371f76d3c0725f195c157 /doc
parentba4202cce98d8bef3d91f0d6edf1aa0ae1d1704d (diff)
downloadgrep-a517df5bd51e68c1290ec596b87e8fbe7a381279.tar.gz
doc: Add -- to more-complex example
Suggested by Stephane Chazelas (Bug#38792). * doc/grep.in.1, doc/grep.texi: Add ‘--’ to recently-added example.
Diffstat (limited to 'doc')
-rw-r--r--doc/grep.in.111
-rw-r--r--doc/grep.texi7
2 files changed, 12 insertions, 6 deletions
diff --git a/doc/grep.in.1 b/doc/grep.in.1
index a3829660..a91b2a6f 100644
--- a/doc/grep.in.1
+++ b/doc/grep.in.1
@@ -1333,13 +1333,18 @@ The following example outputs the location and contents of any line
containing \*(lqf\*(rq and ending in \*(lq.c\*(rq,
within all files in the current directory whose names
contain \*(lqg\*(rq and end in \*(lq.h\*(rq.
-The command also searches the empty file /dev/null,
-so that file names are displayed
+The
+.B \-n
+option outputs line numbers, the
+.B \-\-
+argument treats expansions of \*(lq*g*.h\*(rq starting with \*(lq\-\*(rq
+as file names not options,
+and the empty file /dev/null causes file names to be output
even if only one file name happens to be of the form \*(lq*g*.h\*(rq.
.PP
.in +2n
.EX
-$ \fBgrep\fP \-n 'f.*\e.c$' *g*.h /dev/null
+$ \fBgrep\fP \-n \-\- 'f.*\e.c$' *g*.h /dev/null
argmatch.h:1:/* definitions and prototypes for argmatch.c
.EE
.in
diff --git a/doc/grep.texi b/doc/grep.texi
index 873b53c0..42832ab1 100644
--- a/doc/grep.texi
+++ b/doc/grep.texi
@@ -1585,12 +1585,13 @@ 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}.
-The command also searches the empty file @file{/dev/null},
-so that file names are displayed
+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
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}
+$ @kbd{grep -n -- 'f.*\.c$' *g*.h /dev/null}
argmatch.h:1:/* definitions and prototypes for argmatch.c
@end example