If the phrase split across a line break does not count then it is easy. If it does count then it is rather hard to do in a one liner without being clunky..
Of course the last only works with one input file, and I got so worried about line breaks I forgot to make it short. (cunning tachyon)# No worries about line breaks perl -i -pe's/Will Emigh/YAPH Emigh/g' # line breaks concern me but STDOUT will do perl -pe'$a.=$_}{$_=$a;s/Will(\n*) (\n*)Emigh/YAPH\1 \2Emigh/g' # line break concern me and lets put it back in the file perl -ne'BEGIN{$f=$ARGV[0]}$a.=$_}{$_=$a;s/Will(\n*) (\n*)Emigh/YAPH\1 + \2Emigh/g;open F,">$f";print F $_'
Cheers,
R.
In reply to Re: (Challenge)(for new users) Replacing a text
by Random_Walk
in thread (Challenge)(for new users) Replacing a text
by theroninwins
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |