Quote:
Originally Posted by crts
Sorry, I misread your initial post and realized you want to replace the newlines with literally '\n'. At first I thought you want to simply remove all new lines.
This should (hopefully) do:
Code:
sed ':a $s/\n/\\n/g;N;ba' <<< "$output"
PS:
It is not the same thing. The quoted version did get rid of all the newlines and concatenated the string to one line without leaving any whitespace. The unquoted version replaced the newline with a space.
|
Thank you very much !
Code:
$newoutput=qx(sed ':a \$s/\\n//g;N;ba' <<< "$newoutput"
The above is what ended up working.