#°/bin/bash ADLISTDIR=adlists for adfile in $(ls $ADLISTDIR); do grep -v '^#' < $ADLISTDIR/$adfile | grep -v '^$' | awk '{if (0 < match($0, "\t") || 0 < index($0, " ")) {split($0,b," "); print b[2]} else print $0}' | grep -v '^localhost$' | grep -v '^local$' | grep -v '^localhost.localdomain$' | grep -v '^ip6-localnet$' | grep -v '^ip6-localhost$' | grep -v '^$' | while read blockedAddress; do echo "127.0.0.1 $blockedAddress"; done >> block.list done