# 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 $_'