Fast string search in a very large file
<p>What is the fastest method for searching lines in a file containing a string. I have a file containing strings to search. This small file (smallF) contains about 50,000 lines and looks like:</p>

<p>stringToSearch1<br>
stringToSearch2<br>
stringToSearch3</p>

<p>I have to search all of these strings in a larger file (about <strong>100 million</strong> lines). If any line in this larger file contains the search string the line is printed. </p>

<p>The best method I have come up with so far is </p>

<pre><code>grep -F -f smallF largeF
</code></pre>

<p>But this is not very fast. With just 100 search strings in smallF it takes about 4 minutes. For over 50,000 search strings it will take a lot of time. </p>

<p>Is there a more efficient method?</p>