title: Sed and replacing a string which has the character '\'
body: <p>I have a Bash variable with a string in JSON format.</p>
  
  <p><code>FOO="[{\"name\": \"${NAME}\", \"surname\": \"${SURNAME}\"}]"</code></p>
  
  <p>The content of this variable is then replaced in a file with sed.</p>
  
  <p><code>sed -ie "s/&lt;FOO&gt;/$FOO/g" bar.txt</code></p>
  
  <p>For example, if <code>NAME=John</code> and <code>SURNAME=Doe</code>, I need the string in <code>bar.txt</code> to be exactly <code>"[{\"name\": \"John\", \"surname\": \"Doe\"}]"</code>, but sed is removing the backslashes.</p>
  
  <p>So, how can I manage to do this replace? Tried to use triplets of backslashes (e.g. <code>\\\"name</code>...) but it didn't work either.</p>