title: using awk to exclude a range of rows from one file depeding on second file
body: <p>I have two files - file one contains a number (1-22) in column 1 and a range from a lower number (column 2) and upper number (column 3). Here is the first couple of lines:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>1</th>
  <th>11362778</th>
  <th>12362778</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>1</td>
  <td>22054176</td>
  <td>23054176</td>
  </tr>
  <tr>
  <td>1</td>
  <td>28191734</td>
  <td>29191734</td>
  </tr>
  <tr>
  <td>1</td>
  <td>42956767</td>
  <td>43956767</td>
  </tr>
  <tr>
  <td>1</td>
  <td>65941329</td>
  <td>66941329</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>The first file doesnt have any header.</p>
  <p>In a second file I have a lot of columns first one shown here:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>SNP</th>
  <th>CHR</th>
  <th>BP</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>rs115828134</td>
  <td>1</td>
  <td>11363041</td>
  </tr>
  <tr>
  <td>rs2788537</td>
  <td>1</td>
  <td>11363231</td>
  </tr>
  <tr>
  <td>rs12141932</td>
  <td>1</td>
  <td>11363301</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>What I want to do is remove all rows in file 2 if column 2 in file 2 is equal to column 1 in file 1 AND if column 3 in file 2 falls within the range of column 2 and column 3 in file 2.</p>
  <p>Essentially something like this:, but looping through all the rows of file 1.</p>
  <pre><code>awk '{if($2==1 &amp;&amp; $3 &lt; 11362778 || $3 &gt; 12362778) print $0}' file 2 &gt; results.txt 
  </code></pre>