Hello,
in my shell script i have some multi-line text in a variable $TEMP - f.e.
blablahblah
blah blah
bla TARGET hgloglo
And i need to replace TARGET with text from another variable ($REPLACE), which is containing some text with nasty characters (\n, ", :, etc.) And stuff the altered text back into variable.
I've tried awk
TEMP=$(awk '{gsub(/TARGET/, "$REPLACE"); print}' <<< "$TEMP")
but "$REPLACE" is no longer a variable due its placement
and i assume that even if i managed to force this string to act as a varible, i would be scre*ed, because of tons of special characters deployed into gsub's second argument.
Any ideas? Try perl?
Thanks for even reading this horrid text - i'm sorry for my english.