In bash script :
I want to replace in an html file the occurrence word 'test' with this url : url="http://www.test.com/testcom&_mc_jhc=ex_XZ-r&oh=044"
search='test'
tried sed :
sed -i'.original' 's|'"${search}"'|'"${url}"'|g' index.html
it works but it replaces as well all the & with 'test'
tried with awk :
awk '{sub(/test/,'"${url}"')}1'
But same issue.
why & in the url is also replaced by test?
Any solution ?