]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
src/bin/grepc: -r: Reimplement with grep(1)
authorAlejandro Colomar <alx@kernel.org>
Tue, 4 Nov 2025 14:11:50 +0000 (15:11 +0100)
committerAlejandro Colomar <alx@kernel.org>
Tue, 4 Nov 2025 14:21:16 +0000 (15:21 +0100)
With grep(1), we don't need to hard-code escape sequences.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
src/bin/grepc

index 62791765200e905aeaafc20720406691f56aa9a9..70e312abe31c762d6d11e8b9a6157ba394d6e0d5 100755 (executable)
@@ -78,7 +78,7 @@ else
        | xargs -0 sh -c 'pcre2grep $opts -f "$0" -- "$@" || test $? -eq 1;' "$patterns";
 fi \
 | if test "$r" = 'yes'; then
-       perl -p -e 's/('"$identifier"')/\033[32m\1\033[0m/';
+       grep -h --color=always -P "($identifier|^)";
 else
        cat;
 fi \