As in pcre2grep(1) and grep(1).
Signed-off-by: Alejandro Colomar <alx@kernel.org>
A='';
B='';
C='';
+c='';
h='-H';
i='';
k='no';
grepc_parse_cmd()
{
- while getopts "A:B:C:hiklnrt:" opt; do
+ while getopts "A:B:C:chiklnrt:" opt; do
case "$opt" in
A)
A="-A$OPTARG";
C)
C="-C$OPTARG";
;;
+ c)
+ c='-c';
+ ;;
h)
h='-h';
;;
opts="$opts $A";
opts="$opts $B";
opts="$opts $C";
+ opts="$opts $c";
opts="$opts $h";
opts="$opts $i";
opts="$opts $l";
pcre2grep $opts -f "$patterns";
else
find $files -type f \
- | xargs grep -${i}lPI -- "$identifier" \
+ | if test -z "$c"; then
+ xargs grep -${i}lPI -- "$identifier";
+ else
+ cat;
+ fi \
| xargs pcre2grep $opts -f "$patterns";
fi;
}
.I n
lines of context surrounding a match.
.TP
+.B \-c
+Do not print matches,
+and instead print a count of them.
+.TP
.B \-h
Suppress the prefixing of file names on output.
.TP