title: Bash: Regex match betwen first occurrence of characters
body: <p>Input: </p>
  
  <pre><code>p45-322-16.jpg
  </code></pre>
  
  <p>Desired output: </p>
  
  <pre><code>p45
  </code></pre>
  
  <p>I'm trying to make a bash script with grep or awk or sed or something that could run on a bash shell.</p>
  
  <p>Currently I'm stuck with this:</p>
  
  <pre><code>echo "p45-322-16.jpg" | sed 's/\(.*\)-.*/\1/'
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>p45-322
  </code></pre>