Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

sed replace single line with multi line

DATA="$(cat whatever)"
ESCAPED_DATA="$(echo "${DATA}" | sed ':a;N;$!ba;s/
/
/g' | sed 's/$/$/g')"

Then you can use ${ESCAPED_DATA} in sed:

cat input | sed 's/one liner/'"${ESCAPED_DATA}"'/' > output 
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #sed #replace #single #line #multi #line
ADD COMMENT
Topic
Name
4+9 =