#/bin/ksh # # Sorting windows hosts file and reducing duplicates. # # Written for Solaris 8 # # Kevin. P. Inscoe (kevin@inscoe.org) March 28, 2003 # # globals export LC_COLLATE="en_US" # scp c:\windows\hosts to this directory as "hosts" # cp hosts to hosts.dos then remove everything above the ads line dos2unix hosts.dos hosts.old awk '{ print $2 " " $1 }' hosts.old > hosts.tmp sort -d -f -i -b -k 1 hosts.tmp | uniq | awk '{ print $2 "\t\t" $1 }' > hosts.new echo "Old: `wc -l hosts.old`" echo "New: `wc -l hosts.new`" rm hosts.old rm hosts.tmp unix2dos hosts.new hostsnew.dos rm hosts.new # # How edit hosts and remove below the ads line and append in hostsnew.dos and # transfer back to pc #