summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Colomar <alx.manpages@gmail.com>2022-05-15 01:53:26 +0200
committerAlejandro Colomar <alx.manpages@gmail.com>2022-05-15 01:53:53 +0200
commit10dc8e51b6f58228f231ae3eff78241a5c2c36d7 (patch)
tree45d792a76ec5fc83e9ed74599efcb790a0edefb5
parentffbab42883313e6e02d49bf69d7ac2418720c29d (diff)
grepc: Allow a pattern to start with '-'
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
-rwxr-xr-xbin/grepc10
1 files changed, 5 insertions, 5 deletions
diff --git a/bin/grepc b/bin/grepc
index ad4bccd..55758fd 100755
--- a/bin/grepc
+++ b/bin/grepc
@@ -132,18 +132,18 @@ grepc_find_files()
else
find $FILES -type f;
fi \
- | grep -P "$ext" \
- | xargs grep -lPI "$1\b" \
+ | grep -P -- "$ext" \
+ | xargs grep -lPI -- "$1\b" \
>"$files";
}
grepc_helper()
{
- xargs grep -lPI "$1" <"$files" \
- | xargs grep -lP "$2" \
+ xargs grep -lPI -- "$1" <"$files" \
+ | xargs grep -lP -- "$2" \
| sort \
- | xargs pcregrep $lflag -Mn "$3" /dev/null \
+ | xargs pcregrep $lflag -Mn -- "$3" /dev/null \
| if [ "$kflag" = 'no' ]; then
sed -E 's/^[^: ]+:[0-9]+:/\n\n&\n/';
else