[BETA] Test find_line grep setup-ngxblocker

This commit is contained in:
Mitchell Krog 2019-07-05 08:49:49 +02:00 committed by GitHub
parent bd71a6d02f
commit 1dfcb4ef43
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -219,8 +219,11 @@ find_line() {
case "$first_last" in
# ignore file #comments
first) awk "/$find_str/{ print NR; exit }" $file;;
last) awk "/$find_str/{ print NR }" $file | tail -n1;;
#first) awk "/$find_str/{ print NR; exit }" $file;;
#last) awk "/$find_str/{ print NR }" $file | tail -n1;;
first) grep -nE "^$[[:space:]]+find_str" $file | head -n1 | awk -F: '{print $1}';;
last) grep -nE "^[[:space:]]+$find_str" $file | tail -n1 | awk -F: '{print $1}';;
esac
}