$ cat > foo.tmp gary is the best frank is the worst $ perl -i.bak -p -e 's/gary/harry/g;' foo.tmp $ cat foo.tmp harry is the best frank is the worst