title: How to use fnmatch from a shell?
body: <p>In a generic shell script, I would like to use shell pattern matching to filter the lines of a text file.</p>
  
  <p>I have a list of file names in files.txt:</p>
  
  <pre><code>file1.txt
  file2.sh
  file3.png
  </code></pre>
  
  <p>And I have a list of patterns in patterns.txt:</p>
  
  <pre><code>other_file.txt
  file2.*
  </code></pre>
  
  <p>If I would have regular expressions in patterns.txt, I could do this:</p>
  
  <pre><code>$ grep -v -f patterns.txt files.txt
  </code></pre>
  
  <p>But I would like to use shell globbing patterns. I found the C function fnmatch but no shell/unix command to use it.</p>