perl -i.bak -pe 's/first/last/g' one.txt #### perl -ni.bak -e 's/first/last/g; print' one.txt