Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clean up the hosts file 1

Status
Not open for further replies.

jdespres

MIS
Aug 4, 1999
230
US
We are in the process of migrating a application from one server to another.

With so many hands in the cookie jar the hosts file is a mess!

I would like to clean it up....

I would like to sort it and arrange the 2nd column at the same position....

Thanks
 
egrep '^[1-9]' hosts|while read adr names
do
printf "%-16s %s\n" ${adr} "${names}"
done|sort

you could use awk also I guess

HTH,

p5wizard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top