I thought of recommending the inplace replace using sed.
Sorry for recommending sed over perl here.. But I believe this needs to be done in sed than in perl.
$sed -i 's#uname#newname#' /etc/hosts/*
I did some time comparison for both perl and sed and it turns out that sed has better performance
$time sed -i 's/sri/harry/' *
sed -i 's/sri/harry/' * 0.00s user 0.01s system 37% cpu 0.016 total
$time perl -pi -e 's/harry/sri/'
perl -pi -e 's/harry/sri/' * 0.01s user 0.01s system 62% cpu 0.029 to
+tal
|