perl -i.bak -pe 's/first/last/g' one.txt
To make your code work you need to change the order of operators and add 'g' modifier to the regexp
perl -ni.bak -e 's/first/last/g; print' one.txt
In reply to Re: How to modify words in a line using perl oneliner
by ccn
in thread How to modify words in a line using perl oneliner
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |