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

Popular posts from this blog

html - How can i make an element from a bottom stacking context stays in front of another higher stacking context? -

python - TypeError: start must be a integer -

html - href attribute breaking an element -