in reply to How to modify words in a line using perl oneliner
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
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: How to modify words in a line using perl oneliner
by BioLion (Curate) on Sep 30, 2009 at 11:10 UTC | |
Re^2: How to modify words in a line using perl oneliner
by Bloodnok (Vicar) on Sep 30, 2009 at 11:36 UTC |
In Section
Seekers of Perl Wisdom