title: Inserting contents of a file with special characters using sed
body: <p>I want to replace a marker (REPLACETHIS) in file1.txt with the entire contents of file2.txt, which will include newlines and special characters.</p>
  
  <p>An example of file2.txt's contents would be</p>
  
  <pre><code>&lt;Location /&gt;
          Order deny,allow
          Deny from all
          Allow from 1.2.3.4
          Allow from 5.6.7.8
  &lt;/Location&gt;
  </code></pre>
  
  <p>My general code, minus handling of special characters, would look something like this:</p>
  
  <pre><code>value=$(&lt;/home/name/scripts/file2.txt)
  sed -i -e "s|REPLACETHIS|$value|" /home/name/scripts/file1.txt
  </code></pre>
  
  <p>What's the best way to go about handling this?</p>