I am looking to sort a list of domain names (a web filter whitelist) starting from the TLD and working upwards. I am looking any *nix or windows tools that can do this easily, though a script would be fine too.
So if the is the list you are given
www.activityvillage.co.uk
ajax.googleapis.com
akhet.co.uk
alchemy.l8r.pl
au.af.mil
bbc.co.uk
bensguide.gpo.gov
chrome.angrybirds.com
cms.hss.gov
crl.godaddy.com
digitalhistory.uh.edu
digital.library.okstate.edu
digital.olivesoftware.com
This is what I want as the output.
chrome.angrybirds.com
crl.godaddy.com
ajax.googleapis.com
digital.olivesoftware.com
digital.library.okstate.edu
digitalhistory.uh.edu
bensguide.gpo.gov
cms.hss.gov
au.af.mil
alchemy.l8r.pl
www.activityvillage.co.uk
akhet.co.uk
bbc.co.uk
Just in case you are wondering why, Squidguard, has a bug/design flaw. If both www.example.com
and example.com
are both included in a list, then the example.com
entry is ignored and you can only visit content from www.example.com
. I have several large lists that need some cleanup because someone added entries without looking first.