Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
hosts block autofetcher
# fetch the new block list
wget '' -O list_all
# reset the old hosts directory
rm -r all_hosts
mkdir all_hosts
# read the file and download into the all_hosts directory
while read a; do
wget -P all_hosts "$a"
done < list_all
# fill the all_blocks file with the fixed up lines of all the hosts files
rm all_blocks
for a in $(command ls -1 all_hosts); do
sed -f fix_host.sed "all_hosts/$a" >> all_blocks
# sort and uniq it
sed -f fix_host.sed all_blocks | sort | uniq > all_blocks.uniq
mv all_blocks.uniq all_blocks
s/\s\+/ /g
s/[ \t]*$//
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.