diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2022-05-16 12:18:26 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2022-05-16 12:19:02 -0700 |
commit | a7c8349894d24cf50e19ae4a6b10fa89d1fd9d87 (patch) | |
tree | 8d9f609afd6d3b64355063294cf5a472c2502269 /doc | |
parent | 078987db6df0edd5af630abf5987e95b02f8a8a3 (diff) | |
download | grep-a7c8349894d24cf50e19ae4a6b10fa89d1fd9d87.tar.gz |
grep: document -m better
* doc/grep.in.1, doc/grep.texi: Document behavior of -m 0 and -m -1.
This documents longstanding behavior, and is consistent with
how git grep -m will likely behave.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/grep.in.1 | 10 | ||||
-rw-r--r-- | doc/grep.texi | 4 |
2 files changed, 14 insertions, 0 deletions
diff --git a/doc/grep.in.1 b/doc/grep.in.1 index aba085ad..5ba90ee2 100644 --- a/doc/grep.in.1 +++ b/doc/grep.in.1 @@ -321,6 +321,16 @@ Scanning each input file stops upon first match. Stop reading a file after .I NUM matching lines. +If +.I NUM +is zero, +.B grep +stops right away without reading input. +A +.I NUM +of \-1 is treated as infinity and +.B grep +does not stop; this is the default. If the input is standard input from a regular file, and .I NUM diff --git a/doc/grep.texi b/doc/grep.texi index b9688c82..b073fa76 100644 --- a/doc/grep.texi +++ b/doc/grep.texi @@ -341,6 +341,10 @@ Scanning each input file stops upon first match. @opindex --max-count @cindex max-count Stop after the first @var{num} selected lines. +If @var{num} is zero, @command{grep} stops right away without reading input. +A @var{num} of @minus{}1 is treated as infinity and @command{grep} +does not stop; this is the default. + If the input is standard input from a regular file, and @var{num} selected lines are output, @command{grep} ensures that the standard input is positioned |