title: How to use sed to extract negative number from a string
body: <p>I need to extract a negative number from a file to another file, I already did this for a positive number, but I couldn't figure out how to do it for negative number.</p>
  
  <pre><code>sed -r 's/.* ([0-9]+\.*[0-9]*).*?/\1/' bob.txt &gt; outfile.txt
  </code></pre>
  
  <p>bob.txt content: </p>
  
  <pre><code>outputVoltage.u900 = Opaque: Float: 27.000000 V
  
  outputVoltage.u900 = Opaque: Float: -27.000000 V
  </code></pre>
  
  <p>The above code works perfectly for the positive value and not the negative value.</p>
  
  <p>Inside outfile, I suppose to have:</p>
  
  <p>27.000000</p>
  
  <p>-27.000000</p>