in reply to How to modify words in a line using perl oneliner
What you are printing is the number of substitutions on each line, ie. "1" when "first" is found, and undef (nothing) when not. A value of "2" would be returned for line 2 if "g" modifier were used.
Prefer -p option instead of -n for this kind of one-liners. In this case, the output should be:
perl -pi.bak -e 's/first/last/' one.txt #verify_custom fleet part=last base=first after base
realizing that "g" modifier is missing if both "first" words must be changed at the same time.
|
|---|