From 1e7f8439933c86d0af6ee635cc515ec406269ba3 Mon Sep 17 00:00:00 2001 From: Jesse Becker Date: Sat, 12 Sep 2015 00:03:56 -0400 Subject: [PATCH] Simplify (and speed up slightly) awk/sed domain name extraction --- gravity.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gravity.sh b/gravity.sh index 23356a6f..3ecca983 100755 --- a/gravity.sh +++ b/gravity.sh @@ -115,8 +115,8 @@ do # Most of the lists downloaded are already in hosts file format but the spacing/formating is not contigious # 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 - awk 'NF {if ($1 !~ "#") { if (NF>1) {print $2} else {print $1}}}' $tmpfile | \ - sed -e 's/^[. \t]*//' -e 's/\.\.\+/./g' -e 's/[. \t]*$//' | grep "\." > $saveLocation + awk '($1 !~ /^#/) { if (NF>1) {print $2} else {print $1}}' $tmpfile | \ + sed -nr -e 's/\.{2,}/./g' -e '/\./p' > $saveLocation echo "Done." else echo "Skipping list because it does not have any new entries."