title: Bash script to iterate files in directory and pattern match filenames
body: <p>I need to process a large number of files in a directory. The files can be partitioned into several groups, based upon the file names. That is to say, the file names can be pattern matchedne which 'group'  they belong to. For instance, the names are like this:</p>
  
  <ul>
  <li>YYYYMMDD_*_bulk_import.csv</li>
  <li>YYYYMMDD_*_genstats_import.csv</li>
  <li>YYYYMMDD_*allstats.csv</li>
  </ul>
  
  <p>etc ...</p>
  
  <p>Each 'group' has a different processing methodology (i.e. a different command is called for processing).</p>
  
  <p>I want to write a bash script to:</p>
  
  <ol>
  <li>Iterate through all CSV files in the directory</li>
  <li>Determine which 'group' a file belongs to by pattern matching its name to known patterns (like the examples I gave above)</li>
  <li>Call a command based on the determined grouping.</li>
  </ol>
  
  <p>I am running on Ubuntu 10.0.4. I am new to bash, and would appreciate skeleton code snippet that will help me get started in writing this script.</p>