title: Print last matching line
body: <p>Using <code>sed</code>, I would like to print the last matching line of a file. I came across</p>
  
  <p><a href="https://stackoverflow.com/q/7724778">sed: return last occurrence match until end of file</a></p>
  
  <p>however, I would like only the matching line itself, not any range of lines. Using that page I actually came up with a working command</p>
  
  <pre><code>$ sed '/out_time=/h; $!d; x' progress.txt
  out_time=00:00:07.720000
  </code></pre>
  
  <p>The question is why does this work, or to put another way what is going on in this command. Also include a simpler <code>sed</code> command, if one exists.</p>