title: Extract pattern between a substring and first occurrence of numeric in a string
body: <p>Following is the content of a file:</p>
  
  <pre><code>xxx_component1-1.0-2-2acd314.xc-linux-x86-64-Release-devel.r
  xxx_component2-3.0-1-fg3sdhd.xc-linux-x86-64-Release-devel.r
  xxx_component3-1.0-2-3gsjcgd.xc-linux-x86-64-Release-devel.r
  xxx_component4-0.0-2-2acd314.xc-linux-x86-64-Release-devel.r
  </code></pre>
  
  <p>I want to extract component names component1 component2 etc.</p>
  
  <p>This is what I tried:</p>
  
  <pre><code>for line in `sed -n -e '/^xxx-/p' $file`
  do
      comp=`echo $line | sed  -e '/xxx-/,/[0-9]/p'`
      echo "comp - $comp"
  done
  </code></pre>
  
  <p>I also tried  <code>sed -e 's/.*xxx-\(.*\)[^0-9].*/\1/'</code></p>
  
  <p>This is based on some info on net. Please give me <code>sed</code> command and if possible also explain stepwise</p>
  
  <p>Part 2. I also need to extract  version number from the string.
  version number starts with digit and ends with . followed by xc-linux.
  As you can see to maintain the uniqueness its has random alphanumeric characters ( length is 7) as part of the version number.</p>
  
  <p>For example :
  <strong>xxx_component1-1.0-2-2acd314.xc-linux-x86-64-Release-devel.r</strong>
  In this string the version number is :  <strong>1.0-2-2acd314</strong></p>