Originally Posted by qweeak
Thanks sycamorex. That did the trick. Can you tell how it is escaped here.
In order to evaluate any variable you need to enclose the whole expression in double quotes. If you do it, any backslash will be interpreted as an attempt to escape the character following it so in your original string
the backslash's function was to escape the closing double quote (not what we want) and the sed was looking for a closing backslash
If we escape the backslash
the first backslash will escape the second so the second one will be treated literally as a backslash, which is what sed/regex was looking for to evaluate the whole expression.
I hope that makes sense to you