title: sed: using part of the regular expression to parse the text
body: <p>I have a line of text which looks like this:</p>
  
  <pre><code>/src/my_module_my_branch/my_module 
  </code></pre>
  
  <p>Example: <code>/src/goodcode_dev/goodcode</code></p>
  
  <p>and I need to convert it to:</p>
  
  <pre><code>/src/my_branch/my_module 
  </code></pre>
  
  <p>Example: <code>/src/dev/goodcode</code></p>
  
  <p>The problem both module and branch can include underscores.
  So I need first to identify the module from the third part and use it to extract out the branch name.
  Is there a way using sed to do such conversions?</p>