From 34cec8f5a2daa25d027639fce905e7b65dc1b803 Mon Sep 17 00:00:00 2001 From: Mitchell Krog Date: Fri, 28 Jun 2019 21:22:57 +0200 Subject: [PATCH] FIX setup-ngxblocker REF: #256 REF: #266 Reverting Changes introduced in Commit: 863bf14bab331974379141660a6e67dd18afe407 which switched method of find_line from awk to grep --- setup-ngxblocker | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/setup-ngxblocker b/setup-ngxblocker index b4fd129ee..42ef42c93 100755 --- a/setup-ngxblocker +++ b/setup-ngxblocker @@ -219,8 +219,11 @@ find_line() { case "$first_last" in # ignore file #comments - first) grep -nE "^[ ]+$find_str" $file | head -n1 | awk -F: '{print $1}';; - last) grep -nE "^[ ]+$find_str" $file | tail -n1 | awk -F: '{print $1}';; + #first) grep -nE "^[ ]+$find_str" $file | head -n1 | awk -F: '{print $1}';; + #last) grep -nE "^[ ]+$find_str" $file | tail -n1 | awk -F: '{print $1}';; + # REVERTING TO ORIGINAL WORKING METHOD + first) awk "/$find_str/{ print NR; exit }" $file;; + last) awk "/$find_str/{ print NR }" $file | tail -n1;; esac }