title: Searching multiple files for list of words in a text file
body: <p>I need to go through a huge amount of text files and list the ones that contains ALL of the words listed in another text file.</p>
  
  <p>I need to list only the files containing all of the words. It does not have to be in any specific order. I've tried to use a variety of grep commands, but it only outputs the files containing any of the words, not all of them. It would be ideal to use the txt file containing the list of words as a search for grep. </p>
  
  <ul>
  <li>Expected output is a list of just the files that succeed in the search (files that contains all the words from the "query" text file)</li>
  </ul>
  
  <p>Tried </p>
  
  <p><code>grep -Ffw word_list.txt /*.fas</code>  </p>
  
  <p><code>find . -exec grep "word_list.txt" '{}' \; -print</code>  </p>
  
  <p>I've found solutions using a number of pipes like</p>
  
  <p><code>awk "/word1/&amp;&amp;/word2/&amp;&amp;/word3/" ./*.txt</code></p>
  
  <p><code>find . -path '*.txt' -prune -o -type f -exec gawk '/word1/{a=1}/word2/{b=1}/word3/{c=1}END{ if (a &amp;&amp; b &amp;&amp; c) print FILENAME }' {} \;</code></p>
  
  <p>But I have a huge list of words and would be impractical.</p>
  
  <p>Thank you.</p>