title: Extract part of a filename shell script
body: <p>In bash I would like to extract part of many filenames and save that output to another file. </p>
  
  <p>The files are formatted as coffee_{SOME NUMBERS I WANT}.freqdist.</p>
  
  <pre><code>#!/bin/sh
  for f in $(find . -name 'coffee*.freqdist)
  </code></pre>
  
  <p>That code will find all the coffee_{SOME NUMBERS I WANT}.freqdist file. Now, how do I make an array containing just {SOME NUMBERS I WANT} and write that to file?</p>
  
  <p>I know that to write to file one would end the line with the following.</p>
  
  <pre><code>  &gt; log.txt
  </code></pre>
  
  <p>I'm missing the middle part though of how to filter the list of filenames.</p>