title: Backtracking with the awk (GNU) command
body: <p>Say one of your data files returns you all their readings. After removing all the clutter; you obtain, with always 3 columns:</p>
  <pre><code>-ERROR -1.57 -2.02 
  -2.10 -0.57 ERROR
  -4.70 ERROR -0.52 
  -2.20 ERROR -0.02 
  -2.20 -0.07 ERROR
  </code></pre>
  <p>I know <code>ERROR</code> is <strong>the only error message</strong> and happens for any data at random, and is, therefore, the only value that isn't a number.</p>
  <p><strong>THE CHALLENGE</strong></p>
  <p>How can I replace any invalid reading with the last successful one? I've tried</p>
  <pre><code>awk -F' ' ' {if (isNumber $1){ replace with previous $1}}' &lt; log.data
  </code></pre>
  <p>But how do you reference the previous reading to begin with?</p>
  <p>Expected output:</p>
  <pre><code> 0 -1.57 -2.02 
  -2.10 -0.57 -2.02
  -4.70 -0.57 -0.52 
  -2.20 -0.57 -0.02 
  -2.20 -0.07 -0.02
  </code></pre>