rename a string in a perl script eg name("this stays the same") -
perl -pi-back -e 's/actual_word\(`something`\)/expected_word\(`something`\)/g;' \ inputfile.txt
i need "something" stay same. variable changes.
i think should it?
perl -pi-back -e 's/actual_word(.*)/expected_word($1)/g;' inputfile.txt
you capture word in brackets , reuse via $1
in replacement. (you may need more brackets - it's unclear if additional required based on input).
Comments
Post a Comment