From fb72ac9904818e72ce486eede6c9b10ae89011ab Mon Sep 17 00:00:00 2001 From: DL6ER Date: Tue, 6 Dec 2016 08:18:49 +0100 Subject: [PATCH] Show only exact matches for pihole -q --- pihole | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pihole b/pihole index 8adb15ed..e1210dc8 100755 --- a/pihole +++ b/pihole @@ -71,10 +71,10 @@ queryFunc() { domain="${2}" lists=( /etc/pihole/list.* /etc/pihole/blacklist.txt) for list in ${lists[@]}; do - count=$(grep -c ${domain} $list) + count=$(grep -c -E "(^|\s)${domain}($|\s)" $list) echo "::: ${list} (${count} results)" if [[ ${count} > 0 ]]; then - grep ${domain} ${list} + grep -E "(^|\s)${domain}($|\s)" ${list} fi echo "" done