title: sed -i '/$(command 1)/$(command 2)/' myHtmlFile ? Inline editing with sed and awk
body: <p>I'm writing a shell script that builds and edits an html file whose main content is basically clamscan's (ClamAV) output. 
  So, the script's mission is : translating the output, removing unhelpful stuff, adding html tags and so on.
  Though, i'm stuck with the last modification i want.</p>
  
  <p>One part of the edited output from clamscan looks like this :</p>
  
  <pre><code>/path/to/infected-file: Eicar-Test-Signature&lt;span class="mep-subhead-warning"&gt; FOUND&lt;/span&gt;
  /path/to/infected-zipfile!(1)ZIP:eicar.com: Eicar-Test-Signature&lt;span class="mep-subhead-warning"&gt; FOUND&lt;/span&gt;
  /path/to/infected-zipfilewithinzipfile!ZIP:eicar_com.zip!(2)ZIP:eicar.com: Eicar-Test-Signature&lt;span class="mep-subhead-warning"&gt; FOUND&lt;/span&gt;
  </code></pre>
  
  <p>I want to shrink those long lines. Something like this would be the best : </p>
  
  <pre><code>infected-file: Eicar-Test-Signature&lt;span class="mep-subhead-warning"&gt; FOUND&lt;/span&gt;
  infected-zipfile: Eicar-Test-Signature&lt;span class="mep-subhead-warning"&gt; FOUND&lt;/span&gt;
  infected-zipfilewithinzipfile: Eicar-Test-Signature&lt;span class="mep-subhead-warning"&gt; FOUND&lt;/span&gt;
  </code></pre>
  
  <p>But i'd already be happy to just remove the path to the infected file.</p>
  
  <p>Since it seemed easy to get some results with awk and i used sed for all previous editing, I thought my best option was going with something like :
  <code>sed -i 's/&lt;awk command 1&gt;/&lt;awk command 2&gt;/' myHtmlFile</code> </p>
  
  <p>Unfortunately i spent a few hours turning this in various way with no luck.</p>
  
  <p>There seems to be syntax issues with things like :</p>
  
  <pre><code>sed "s#$(awk -F': ' '{print $1}' testfile)#$(awk -F': ' '{print $1}' testfile | awk -F'\' '{print $NF}')#" testfile
  </code></pre>
  
  <p>whether i use single or double quotes, whether i try to concatenate sed strings or try to escape various chars depending on the chosen syntax.</p>
  
  <p>I also though about loops (so that i could make sed work with vars containing awk results) but i'm unsure how to manage a loop for this kind of inline editing.
  It could probably be solved with a powerful regex, but i'm quite bad at it ^^</p>