title: Get content between a pair of HTML tags using Bash
body: <p>I need to get the HTML contents between a pair of given tags using a bash script.
  As an example, having the HTML code below:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;/head&gt;
  &lt;body&gt;
   text
    &lt;div&gt;
    text2
      &lt;div&gt;
          text3
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Using the bash command/script, given the <em>body</em> tag, we would get:</p>
  
  <pre><code> text
    &lt;div&gt;
    text2
      &lt;div&gt;
      text3
      &lt;/div&gt;
    &lt;/div&gt;
  </code></pre>
  
  <p>Thanks in advance.</p>