title: How to read output of sed into a variable
body: <p>I have variable which has value <code>"abcd.txt"</code>.</p>
  
  <p>I want to store everything before the <code>".txt"</code> in a second variable, replacing the <code>".txt"</code> with <code>".log"</code></p>
  
  <p>I have no problem echoing the desired value:</p>
  
  <pre><code>a="abcd.txt"
  
  echo $a | sed 's/.txt/.log/'
  </code></pre>
  
  <p>But how do I get the value <code>"abcd.log"</code> into the second variable?</p>