I have a minified js file. Contains special characters like pipes, dashes, slashes, etc.
Also, I've another HTML file that contains a comment inside:
<!--#MY_SNIPPET#-->
I'm trying to use sed to inject my js file and replace it with the comment above.
Example of my.js
<script>whatever|@</script><script>-my</script>
I'm currently doing:
VARIABLE=$(cat my.js)
sed -i "s|<!--#MY_SNIPPET#-->|${VARIABLE}|" index.html
But I'm getting sed: unmatched '|'
I assume that sed is trying to evaluate the string and that's why is failing but I'm wondering if there's an easy way to make it possible just using sed because I'd like to avoid using Perl or anything else.
Doesn't matter the delimiter, it always throws the same error.
 
     
     
    