title: algorithm - how do I use data from one file as criteria for search/delete from a different file?
body: <p>I have two different pipe-delimited data files. One is larger than the other. I'm trying to selectively remove data from the large file (we'll call it file A), based on the data contained in the small file (file B). File A contains all of the data, and file B contains only a portion of the data from file A.</p>
  
  <p>I want a function or existing program that removes all of the data contained within file B from file A. I had in mind a function like this:</p>
  
  <pre><code>Pseudo-code:
  
      while !eof(fileB) {
          criteria = readLine(fileB);
          lineToRemove = searchForLine(criteria, fileA);
          deleteLine(lineToRemove, fileA);
      }
  </code></pre>
  
  <p>However, that solution seems very inefficient to me. File A has 23,000 lines in it, and file B has 17,000. And the data contained within file B is literally scattered throughout file A.</p>
  
  <p>If there is a program that can do this, I'd prefer it over code. I'm not picky about the code either. C++ is my strong language, but this data file is going to get converted into a SQL database in the near future so I'm good with SQL/PHP code as well.</p>