2
rated 0 times
[
2]
[
0]
/ answers: 1 / hits: 701
/ 2 Years ago, sun, september 18, 2022, 6:38:52
I have a sequence of search patterns stored in a bash array (ptrn
), which I want to pass to a grep
command. How can I do it?
ptrn=("FN" "DS")
for fl in "$@"; do # loop through number of files
if [[ -f "$fl" ]]; then
printf '
%s%s%s
' "$mgn" "==> $flnm <==" "$rst"
grep --color "$ptrn" "$flnm"
fi
done
More From » bash