From ac49e639bdc1e4e046a06864514200969992fdf0 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Mon, 26 Sep 2016 11:58:07 +0100 Subject: [PATCH] Fix #718 --- gravity.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gravity.sh b/gravity.sh index ca2ef57d..05354c43 100755 --- a/gravity.sh +++ b/gravity.sh @@ -289,7 +289,10 @@ function gravity_advanced() { # This helps with that and makes it easier to read # It also helps with debugging so each stage of the script can be researched more in depth echo -n "::: Formatting list of domains to remove comments...." - awk '($1 !~ /^#/) { if (NF>1) {print $2} else {print $1}}' ${piholeDir}/${matterAndLight} | sed -nr -e 's/\.{2,}/./g' -e '/\./p' > ${piholeDir}/${supernova} + #awk '($1 !~ /^#/) { if (NF>1) {print $2} else {print $1}}' ${piholeDir}/${matterAndLight} | sed -nr -e 's/\.{2,}/./g' -e '/\./p' > ${piholeDir}/${supernova} + #Above line does not correctly grab domains where comment is on the same line (e.g 'addomain.com #comment') + #Add additional awk command to read all lines up to a '#', and then continue as we were + cat ${piholeDir}/${matterAndLight} | awk -F'#' '{print $1}' | awk '($1 !~ /^#/) { if (NF>1) {print $2} else {print $1}}' | sed -nr -e 's/\.{2,}/./g' -e '/\./p' > ${piholeDir}/${supernova} echo " done!" numberOf=$(wc -l < ${piholeDir}/${supernova})