I\'m working on a bash-script that has to prepare an E-Mail for being sent to a user.
It aggregates some data, which ends up being multiple lines of stuff. For the e
I tried it and sed 's/pattern/\na\nb\nc/g' but it does not work on all systems. What does work is putting a \ followed by a newline in the replace pattern, like this:
sed 's/pattern/a\
b\
c/g'
This appends a line containing b and a line containing c when the pattern is seen.
To put it in a variable, use double backslashes:
export DATA="\\
a\\
b\\
c"
and then:
sed "s/pattern/${DATA}/g"
Note the double quotes.