From 03340fb70f7f5ded5c3c4fb82a335bdb4248879b Mon Sep 17 00:00:00 2001 From: Mitchell Krog Date: Thu, 4 Jul 2019 09:07:00 +0200 Subject: [PATCH] TEST grep first) last) REF: 34cec8f5a2daa25d027639fce905e7b65dc1b803 --- .dev-tools/setup-ngxblocker/setup-ngxblocker | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.dev-tools/setup-ngxblocker/setup-ngxblocker b/.dev-tools/setup-ngxblocker/setup-ngxblocker index f57f46384..b9a0d61af 100644 --- a/.dev-tools/setup-ngxblocker/setup-ngxblocker +++ b/.dev-tools/setup-ngxblocker/setup-ngxblocker @@ -219,8 +219,10 @@ 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 "^[ ]+$find_str" $file | head -n1 | awk -F: '{print $1}';; + last) grep -nE "^[ ]+$find_str" $file | tail -n1 | awk -F: '{print $1}';; esac }