title: extracting <table> from html with sed magic
body: <p>I have an html page with many tables. </p>
  
  <pre><code>&lt;html&gt;
  &lt;table&gt;
    POINTER_TEXT
    some other stuff
    &lt;table that i want START&gt;
    &lt;/table that i want END&gt;
    some other stuff
    &lt;table bad&gt;
    &lt;/table bad&gt;
  &lt;/table&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I wish to grab a table that comes after a specific text. I am good until this stage.</p>
  
  <pre><code>curl -silent http://xyz.com/1.htm | sed -n '/POINTER_TEXT/,$p'
  </code></pre>
  
  <p>This gives me </p>
  
  <pre><code>  POINTER_TEXT
    some other stuff
    &lt;table that i want START&gt;
    &lt;/table that i want END&gt;
    some other stuff
    &lt;table bad&gt;
    &lt;/table bad&gt;
  &lt;/table&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Then I add this:</p>
  
  <pre><code>curl -silent http://xyz.com/1.htm | sed -n '/POINTER_TEXT/,$p' | sed -n '/&lt;table*/,/&lt;\/table&gt;/p'
  </code></pre>
  
  <p>which gives me this:</p>
  
  <pre><code>  &lt;table that i want START&gt;
    &lt;/table that i want END&gt;
    &lt;table bad&gt;
    &lt;/table bad&gt;
  </code></pre>
  
  <p>My problem is I just need this:</p>
  
  <pre><code>  &lt;table that i want START&gt;
    &lt;/table that i want END&gt;
  </code></pre>
  
  <p>Help me please guys!</p>