I want to substitute a variable SERVICE with a string $service which contains a backslash using sed. I did the following
sed "s/SERVICE/`printf '%q' "${service}"`/g"
Using this I am getting the substituted string as
b_a^c_b_\]Wdd[]X\[X\[W206C?2@,.\\,A@2AW!w6"|
where as I want
b_a^c_b_\]Wdd[]X\[X\[W206C?2@,.\,A@2AW!w6"|
Is there any other way to do it. PS(The string $service has many different special characters)