]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
bin/, man/: -m: Add flag, and pass it to pcre2grep(1)
authorAlejandro Colomar <alx@kernel.org>
Fri, 10 May 2024 10:42:01 +0000 (12:42 +0200)
committerAlejandro Colomar <alx@kernel.org>
Wed, 29 Oct 2025 20:29:27 +0000 (21:29 +0100)
Signed-off-by: Alejandro Colomar <alx@kernel.org>
bin/grepc
share/man/man1/grepc.1

index df2978f9d2acf4b0bcd365a16f1a0876039daf90..592306df13190ff93b77fe7e093beda6181edd81 100755 (executable)
--- a/bin/grepc
+++ b/bin/grepc
@@ -10,6 +10,7 @@ h='-H';
 i='';
 k='no';
 l='';
+m='';
 n='';
 r='no';
 t='no';
@@ -46,7 +47,7 @@ grepc_err()
 }
 
 
-while getopts "A:B:C:chiklnrt:x:" opt; do
+while getopts "A:B:C:chiklm:nrt:x:" opt; do
        case "$opt" in
        A)      A="-A$OPTARG";  ;;&
        B)      B="-B$OPTARG";  ;;&
@@ -56,6 +57,7 @@ while getopts "A:B:C:chiklnrt:x:" opt; do
        i)      i='-i';         ;;&
        k | l)  k='yes';        ;;&
        l)      l='-l';         ;;&
+       m)      m="-m$OPTARG";  ;;&
        n)      n='-n';         ;;&
        r)      r='yes';        ;;&
        t)
@@ -223,7 +225,7 @@ patterns="$(mktemp -t grepc.patterns.XXXXXX)";
 
 
 # shellcheck disable=SC2206  # We want only non-empty variables in the array.
-opts=($A $B $C $c $h $i $l -M $n);
+opts=($A $B $C $c $h $i $l -M $m $n);
 
 
 if test -z "$*"; then
index e1236c7161ad66bd315d8dc63bfde3d6bfdaf060..fd2c8e13563d612c0050070e21df79313a9592c6 100644 (file)
@@ -159,6 +159,11 @@ instead print the name of each input file
 from which output would normally have been printed.
 Each file is only printed once.
 .TP
+.B \-m \~n
+Stop processing after finding
+.I n
+matches.
+.TP
 .B \-n
 Prefix each line of output with the
 1-based line number within its input file.