From 876170767c72d3db9b319214593d0a8921773a78 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Sat, 13 Jan 2018 16:43:20 +0000 Subject: [PATCH 1/2] Print actual domain instead of grep output of "Binary file /etc/pihole/list.preEventHorizon matches" when a domain with a unicode char is in a source list. Signed-off-by: Adam Warner --- gravity.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gravity.sh b/gravity.sh index 40debd61..536cad27 100755 --- a/gravity.sh +++ b/gravity.sh @@ -449,7 +449,7 @@ gravity_Whitelist() { echo -ne " ${INFO} ${str}..." # Print everything from preEventHorizon into whitelistMatter EXCEPT domains in $whitelistFile - grep -F -x -v -f "${whitelistFile}" "${piholeDir}/${preEventHorizon}" > "${piholeDir}/${whitelistMatter}" + comm -23 "${piholeDir}/${preEventHorizon}" <(sort "${whitelistFile}") > "${piholeDir}/${whitelistMatter}" echo -e "${OVER} ${INFO} ${str}" } From 55e10d8287df8721a325d42761c9a04823c0b9db Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Sun, 28 Jan 2018 00:50:15 +0000 Subject: [PATCH 2/2] replace another grep -F as pointed out by @StarPicard Signed-off-by: Adam Warner --- gravity.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gravity.sh b/gravity.sh index 536cad27..d83d271a 100755 --- a/gravity.sh +++ b/gravity.sh @@ -330,7 +330,7 @@ gravity_ParseFileIntoDomains() { }' "${source}" > "${destination}.exceptionsFile.tmp" # Remove exceptions - grep -F -x -v -f "${destination}.exceptionsFile.tmp" "${destination}" > "${source}" + comm -23 "${destination}" <(sort "${destination}.exceptionsFile.tmp") > "${source}" mv "${source}" "${destination}" fi