This leaves -c unused, so we can add -c with the same meaning of
grep(1): count.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
A='';
B='';
C='';
-c='no';
h='-H';
i='';
k='no';
l='';
n='';
+r='no';
t='no';
t_e='no';
t_fp='no';
grepc_parse_cmd()
{
- while getopts "A:B:C:chiklnt:" opt; do
+ while getopts "A:B:C:hiklnrt:" opt; do
case "$opt" in
A)
A="-A$OPTARG";
C)
C="-C$OPTARG";
;;
- c)
- c='yes';
- ;;
h)
h='-h';
;;
n)
n='-n';
;;
+ r)
+ r='yes';
+ ;;
t)
case "$OPTARG" in
e)
grepc_search \
| sed -E -f <(test "$k" = 'no' && echo 's/^[^: ]+:[0-9]+:/\n\n&\n/') \
- | perl -pe "$(test "$c" = 'yes' && echo 's/('"$identifier"')/\033[32m\1\033[0m/' || echo 's///')" \
+ | perl -pe "$(test "$r" = 'yes' && echo 's/('"$identifier"')/\033[32m\1\033[0m/' || echo 's///')" \
| if [ -n "$l" ]; then
sort \
| uniq;
.I n
lines of context surrounding a match.
.TP
-.B \-c
-Surround the matched strings
-with escape sequences to display them in color on the terminal.
-.TP
.B \-h
Suppress the prefixing of file names on output.
.TP
Prefix each line of output with the
1-based line number within its input file.
.TP
+.B \-r
+.RI (colo r )
+Surround the matched strings
+with escape sequences to display them in color on the terminal.
+.TP
.BI \-t " type"
Restrict the search to a specific
.I type