perl: replace a string with variable containing new lines (line breaks)
perl: replace a string with variable containing new lines (line breaks) I want to make edits containing meta characters. Here https://stackoverflow.com/questions/29613304/is-it-possible-to-escape-regex-metacharacters-reliably-with-sed one of solutions is via perl with sQ … E (near end of accepted answer). It is mentioned it handles multi-liners, but: echo ‘a-b’ > a.txt;from=’-‘;to=’n’;perl -s -0777 -pe ‘s/Q$fromE/$to/’ — -from="$from" -to="$to" a.txt …