Goal: I want to replace a string with content of file which has unix code.
What I'm trying to do is:
First: I'm storing the contents of file to a variable
variable=`cat sample.sh`
variable2="$(sed -z 's:\n:\\\n:g;$s:\\\n$::'<<<"$variable")"
and then using that variable in sed command to replace the text with variable value.
sed -i "s:SearchString:$variable2//&/\\\&}:g"<<<"SearchString" File.html
The sed command throws error stating that
sed: -e expression #, char 5: unknown option to s'
Please help to achieve my target.