summaryrefslogtreecommitdiffstats
path: root/buildAdBlocklist.sh
blob: 181f485f50c73a7cc37e18a0d48dd8e1e6af5de5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/bash
awk -F'[\t ]+' '{
  if (!match($0, /^[\t ]*(#|$)/)) {
    if (NF>=2 && length($2)) {
      host=$2
    } else {
      host=$1
    }
    if (!match(host, /^(localhost|local|localhost.localdomain|ip6-localnet|ip6-localhost$)$/)) {
      print "127.0.0.1 " host
    }
  }
}' adlists/* | sort > block.list