title: How can I get the middle part of a file name which have a separator?
body: <p>I know the methods of get the first and last part of a file name which is separated by a delimiter. For example:  </p>
  
  <pre><code>#!/bin/bash
  file_name=aaa.bbb.ccc.ddd
  first_name=${file_name%%.*}
  last_name=${file_name##*.}
  echo first name is: $first_name
  echo last name is: $last_name
  </code></pre>
  
  <p>The output is:  </p>
  
  <pre><code>first name is: aaa
  last name is: ddd
  </code></pre>
  
  <p>But if I want to get <code>bbb</code> or <code>ccc</code>, how can I get it? Thanks very much in advance!</p>