title: Print lines in one file matching patterns in another file
body: <p>I have a file with more than 40.000 lines (file1) and I want to extract the lines matching patterns in file2 (about 6000 lines). I use grep like this, but it is very slow:</p>
  <pre><code>grep -f file2 file1 &gt; out
  </code></pre>
  <p>Is there a faster way to do this using <code>awk</code> or <code>sed</code>?</p>
  <p>Here's some extracts from my files:</p>
  <p><code>File1</code>:</p>
  <pre><code>scitn003869.2| scign003869 CGCATGTGTGCATGTATTATCGTATCCCTTG
  scitn007747.1| scign007747  CACGCAGACGCAGTGGAGCATTCCAGGTCACAA
  scitn003155.1| scign003155  TAAAAATCGTTAGCACTCGCTTGGTACACTAAC
  scitn018252.1| scign018252  CGTGTGTGTGCATATGTGTGCATGCGTG
  scitn004671.2| scign004671  TCCTCAGGTTTTGAAAGGCAGGGTAAGTGCT
  </code></pre>
  <p><code>File2</code>:</p>
  <pre><code>scign000003
  scign000004
  scign000005
  scign004671
  scign000013
  </code></pre>