#!perl -i @ARGV = ("/etc/hosts"); while(<>){ s/OLDIP/NEWIP; # change the ip s/OLDHOSTNAME/NEWHOSTNAME; # change the hostname print; } # repeat a while loop like this for all of the network files.