]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
bin/grepc, grepc.1: -h: Add option to suppress prefixing file names
authorAlejandro Colomar <alx@kernel.org>
Sat, 4 Nov 2023 20:47:44 +0000 (21:47 +0100)
committerAlejandro Colomar <alx@kernel.org>
Wed, 29 Oct 2025 20:29:20 +0000 (21:29 +0100)
Equivalent to grep(1)'s -h, except that we always default to -H behavior.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
bin/grepc
share/man/man1/grepc.1

index f403092d0e4ce001a3d454847399fef79667539c..1807c3852bf64fc8c9166a5c4770bfa5a087c537 100755 (executable)
--- a/bin/grepc
+++ b/bin/grepc
@@ -3,6 +3,7 @@
 
 # Defaults:
 c='no';
+h='H';
 i='';
 l='';
 k='no';
@@ -39,11 +40,14 @@ grepc_err()
 
 grepc_parse_cmd()
 {
-       while getopts "ciklt:" opt; do
+       while getopts "chiklt:" opt; do
                case "$opt" in
                c)
                        c='yes';
                        ;;
+               h)
+                       h='h';
+                       ;;
                i)
                        i='i';
                        ;;
@@ -232,11 +236,11 @@ grepc_search()
        grepc_patterns "$identifier" >"$patterns";
 
        if test -z "$files"; then
-               pcre2grep -${i}${l}HMn -f "$patterns";
+               pcre2grep -${h}${i}${l}HMn -f "$patterns";
        else
                find $files -type f \
                | xargs grep -${i}lPI -- "$identifier" \
-               | xargs pcre2grep -${i}${l}HMn -f "$patterns";
+               | xargs pcre2grep -${h}${i}${l}HMn -f "$patterns";
        fi;
 }
 
index fad8c88a12dc131b39334e783f4548371790c95f..0e01781c72548a724fe2f22a4588bb5bbf07c7c7 100644 (file)
@@ -129,6 +129,9 @@ Only uses
 .RB ( u\fI*\fP )
 are highlighted.
 .TP
+.B \-h
+Suppress the prefixing of file names on output.
+.TP
 .B \-i
 Ignore case distinctions in
 .IR pattern .