title: bash script to interact over several files
body: <p>I need to perform the following tasks. These are included in a bash script.</p>
  
  <p>1) Read from a file such as the one below, and for all the lines that have both the vars
  var1="AB" and var2="14003" I need to catch the substring from col 4 with a len of 8, say in var3,(an array, prob. or in a loop, and then delete those lines.</p>
  
  <pre><code>2 *563587992014-01-26      2014-01-26T09:45:53     AB  14003 5         3.60
  2  563589242014-01-26      2014-01-26T10:03:13     AB  14003 6         4.80
  2  563589252014-01-26      2014-01-26T10:03:20     TC  14002 2         5.50
  2  563589272014-01-26      2014-01-26T10:03:34     FF  14002 3         3.30
  </code></pre>
  
  <p>matching fields marked with *
  2) Then I need to go thru the collected substrings and to open another file like the one below and to delete all lines that the substring(4,8) matches the previous collected in var3</p>
  
  <pre><code>    56370388   1   1.000    95         0.80Double Coffe
     *56358799   1   1.000    94         0.40Milk‚
     *56358799   2   1.000    94         0.40Coffe‚
      56370388   1   1.000    97         0.40Descafe
  </code></pre>
  
  <p>I was thinking maybe in a nested loop, using awk and sed. But inputs would be appreciated :)</p>