title: Powershell text search - multiple matches
body: <p>I have a group of .txt files that contain one or two of the following strings.</p>
  
  <p><code>"red", "blue", "green", "orange", "purple", ....</code> many more (50+) possibilities in the list.</p>
  
  <p>If it helps, I can tell if the .txt file contains one or two items, but don't know which one/ones they are. The string patterns are always on their own line.</p>
  
  <p>I'd like the script to tell me specifically which one or two string matches (from the master list) it found, and the order in which it found them. (Which one was first)</p>
  
  <p>Since I have a lot of text files to search, I'd like to write the output results to a CSV file as I search.</p>
  
  <pre><code>FILENAME1,first_match,second_match
  
  file1.txt,blue,red
  file2.txt,red, blue
  file3.txt,orange,
  file4.txt,purple,red
  file5.txt,purple,
  ...
  </code></pre>
  
  <p>I've tried using many individual <code>Select-Strings</code> returning Boolean results to set variables with any matches found, but with the number of possible strings it gets ugly real fast.  My search results for this issue has provided me with no new ideas to try.  (I'm sure I'm not asking in the correct way)</p>
  
  <p>Do I need to loop through each line of text in each file?</p>
  
  <p>Am I stuck with the process of elimination method by checking for the existence of each search string?</p>
  
  <p>I'm looking for a more elegant approach to this problem. (if one exists)</p>