title: bash - regex string from command line
body: <p>I'm trying to do something like this:</p>
  
  <pre><code>wget -O - http://example.com/myfolder/myfile | ssh mypc 'cat &gt; /tmp/myfile'
  </code></pre>
  
  <p>Note that 'myfile' is the name used in wget and cat commands. So, my question is if I can apply a regex to the <a href="http://example.com/myfolder/myfile" rel="nofollow">http://example.com/myfolder/myfile</a> in order to pass it to cat command removing all except for the name of the file (in this case m file). Long story short, I would like to have ONE input to give to both commands with help of regex for the second one, something like:</p>
  
  <pre><code>wget -O - http://example.com/myfolder/myfile | ssh mypc 'cat &gt; /tmp/regex(http://example.com/myfolder/myfile, last_occurrence_of(/))'
  </code></pre>
  
  <p>Thanks for the help</p>