Fun with sed and domain blacklists
Wednesday, July 1, 2009 at 10:32AM Well I couldn't sleep one night and a friend sent me a DNS blacklist of domain names. I needed it to be in the windows hosts file format to install on to an old computer, the format looks a little like this:
127.0.0.1 somedomainxxxxxxxxxxxxx.ru
127.0.0.1 someotherurlyyyy.com
However the list had several thousand lines and cut and paste will only get you so far. I used the program sed on my mac to change all these lines quickly.
$ sed "s/^/127.0.0.1\ /" InPutFile >> OutPutFile
fun times :)
Disclaimer: I'm by no means a command line wizard so there is probably a better way of doing this. Security gained by loopback hosts files is also questionable.
dns,
hosts,
sed in
Graham's Blog 
