title: awk: how to execute a command and read its output
body: <p>I would like to read data from stdin and execute a shell command for each parsed line and recover its output.</p>
  
  <p>Here an example which almost works:</p>
  
  <pre><code>[root@eulbi002] # ping eulbi001 | awk -F'[ =]' '/64 bytes/{"date +%s"|getline D; print D,$11}'
  1360069298 0.056
  1360069298 0.051
  1360069298 0.051
  </code></pre>
  
  <p>The command 'date +%s' is executed and I can recover the output, but it looks to me like the execution happens only once, not on every match.</p>
  
  <p>The ultimate aim is to hand the output over to rrdtool for storage and rrdtool wants a timestamp for each record.</p>
  
  <p>@Ed Morton, in addition to point out a working solution, mentioned gawk with its built-in time functions. This is the most elegant solution.</p>
  
  <pre><code>[root@eulbi002] # ping eulbi001 | awk -F'[ =]' '/64 bytes/{print systime(),$11}'
  1360069298 0.056
  1360069298 0.051
  1360069298 0.051
  </code></pre>