summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorAlejandro Colomar <alx@kernel.org>2023-11-05 03:12:53 +0100
committerAlejandro Colomar <alx@kernel.org>2023-11-05 13:00:12 +0100
commit6fc13c5479d9c71ab3a4be86a6e1593868ca8b3e (patch)
tree6113a5b12167bc46486a5a58feee699aa5b16f6f /bin
parentd9d77953bb80b498b83850b6a756aa72cca6cd82 (diff)
bin/grepc, grepc.1: -n: Add option to control printing of line numbers
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/grepc8
1 files changed, 6 insertions, 2 deletions
diff --git a/bin/grepc b/bin/grepc
index f37510d..23de67d 100755
--- a/bin/grepc
+++ b/bin/grepc
@@ -10,6 +10,7 @@ h='-H';
i='';
k='no';
l='';
+n='';
t='no';
t_e='no';
t_fp='no';
@@ -43,7 +44,7 @@ grepc_err()
grepc_parse_cmd()
{
- while getopts "A:B:C:chiklt:" opt; do
+ while getopts "A:B:C:chiklnt:" opt; do
case "$opt" in
A)
A="-A$OPTARG";
@@ -70,6 +71,9 @@ grepc_parse_cmd()
l='-l';
k='yes';
;;
+ n)
+ n='-n';
+ ;;
t)
case "$OPTARG" in
e)
@@ -254,7 +258,7 @@ grepc_search()
opts="$opts $i";
opts="$opts $l";
opts="$opts -M";
- opts="$opts -n";
+ opts="$opts $n";
if test -z "$files"; then
pcre2grep $opts -f "$patterns";