diff options
author | Alejandro Colomar <alx.manpages@gmail.com> | 2022-05-15 01:53:26 +0200 |
---|---|---|
committer | Alejandro Colomar <alx.manpages@gmail.com> | 2022-05-15 01:53:53 +0200 |
commit | 10dc8e51b6f58228f231ae3eff78241a5c2c36d7 (patch) | |
tree | 45d792a76ec5fc83e9ed74599efcb790a0edefb5 | |
parent | ffbab42883313e6e02d49bf69d7ac2418720c29d (diff) |
grepc: Allow a pattern to start with '-'
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
-rwxr-xr-x | bin/grepc | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -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 |