title: How to write a shell script that searches for patterns
body: <p>I have a quite a few files in my folder,all with .dat extension. How do I write a bash shell script that will do something like this</p>
  
  <pre><code>if 2011_ac_.dat then
   do something
  if 2002_bc.dat then 
   do something else
  </code></pre>
  
  <p>So depending on <code>ac</code> or <code>bc</code>,something will be done. Are there regular expressions for shells?</p>