title: Search for a mention of each filename contained in a directory, in every file in the directory
body: <p>I'm trying to perform a search in my directory, to count the total number of times each individual file is referenced within the contents of all the files in the directory. </p>
  
  <p>Essentially, I'm trying to more efficiently recreate the copy and paste of each 'filename' into the 'search in this folder' that I am currently doing, as there are around 400 files. As an output, I think the most useful format would be a list of each search term (filename), and the number of unique files that it occurs in. I am most interested in the files that have no occurrences, as these are likely to be able to be deleted, as they are now redundant. </p>
  
  <p>My current thinking is to save a list of the filenames to a file called searchterms, and use <code>grep -r -f searchterms</code> to find all occurrences of the file. I've not had much luck with this however, as my use of <code>-c</code> so far has just resulted in the file being listed, not the search term.</p>
  
  <p>Thanks in advance!</p>
  
  <p>Example of usage:</p>
  
  <p><strong>file1</strong><br>
  include file3<br>
  include file3   </p>
  
  <p><strong>file2</strong><br>
  content  </p>
  
  <p><strong>file3</strong><br>
  content   </p>
  
  <p><strong>file4</strong><br>
  include file3  </p>
  
  <p>Search terms would be: file1, file2, file3, file4. </p>
  
  <p><strong>Returned output (in some similar form):</strong><br>
  file1: occurs in 0 files<br>
  file2:  occurs in 0 files<br>
  file3: occurs in 2 files<br>
  file4: occurs in 0 files  </p>