title: Extract text from HTML based on table column via Shell Script
body: <p>I need to write a shell script that reads an html file <code>sample.html</code> and extracts data from a table column, based on another table column. For example, this is the HTML code:</p>
  
  <pre><code>&lt;table style="BORDER-COLLAPSE: collapse"
    border="0" bordercolor="#000000"
    cellpadding="3" cellspacing="0" width="100%" height="200"&gt;
    &lt;tr &gt;
      &lt;td class="fontStyleOne" width="30%"&gt;
        &lt;div align="left"&gt;
        core6690.myserverdomain.com &lt;/div&gt;
      &lt;/td&gt;
      &lt;td  class="tdfontTwo" width="30%"&gt;
        &lt;div class="label-styler" align="left"&gt;
        admin&lt;/div&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr &gt;
      &lt;td class="fontStyleOne" width="30%"&gt;
        &lt;div align="left"&gt;
        core6691.myserverdomain.com &lt;/div&gt;
      &lt;/td&gt;
      &lt;td  class="tdfontTwo" width="30%"&gt;
        &lt;div class="label-styler" align="left"&gt;
        secondary &lt;/div&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr &gt;
      &lt;td  class="fontStyleOne" width="30%"&gt;
        &lt;div align="left"&gt;
        core6692.myserverdomain.com &lt;/div&gt;
      &lt;/td&gt;
      &lt;td  class="tdfontTwo" width="30%"&gt;
        &lt;div class="label-styler" align="left"&gt;
        primary &lt;/div&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>Let's say that I want to determine what the URL for "admin" then the result would be core6690.myserverdomain.com; if I my input is "primary" then the output would be "core6692.myserverdomain.com" and so on... </p>
  
  <p>The HTML page has a lot more data, header tags, footer stuff, etc., but the important stuff that I am looking for is placed inside a table with the exact same structure I list in the code... except it has many more rows, not necessarily just 3 as in this example.</p>
  
  <p>I have seen related answers in this site that seg, grep, regular expressions, awk, and other tools however none of them are close enough to what I am looking for... plus I do not have much experience with any of the approaches as to modify and make them fit my needs.</p>
  
  <p>Any suggestions? Thanks in advance.</p>