title: Find and replace in text file with terminal. How to escape all the characters?
body: <p>I'm trying to use the terminal to replace some html code in a file. </p>
  
  <p>This is the command I'm using</p>
  
  <pre><code>perl -pi -w -e 's/find/replace/g;' /Volumes/Abc.html
  </code></pre>
  
  <p>I'm trying to replace </p>
  
  <pre><code>&lt;body&gt; 
  </code></pre>
  
  <p>with</p>
  
  <pre><code>&lt;body&gt;
  &lt;div style="text-align: center;page-break-after:always;padding-top:0%;"&gt;
  &lt;img src="images/image-001.jpg" id="illustration" alt="illustration" /&gt;
  &lt;div id="caption" style="text-align:right;font-style:italic;"&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>so I've been trying this, but I can't figure out how to escape all the characters. Can you help?</p>
  
  <pre><code>perl -pi -w -e 's/&lt;body&gt;/&lt;body&gt;
  &lt;div style="text-align: center;page-break-after:always;padding-top:0%;"&gt;
  &lt;img src="images/image-001.jpg" id="illustration" alt="illustration" /&gt;
  &lt;div id="caption" style="text-align:right;font-style:italic;"&gt;&lt;/div&gt;
  &lt;/div&gt;
  /g;' /Volumes/Abc.html
  </code></pre>
  
  <p>Thanks!</p>