The Random Stuff page is just for everything that does not fit in with the main page. This may include things like reviews of things, blog posts by us, random talk about bananas and things that we think are neat.

Entries in sed (1)

Wednesday
Jul012009

Fun with sed and domain blacklists

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.