title: need to insert datetime in every row of vmstat output
body: <p>I need to insert datetime in every vmstat line that has value. </p>
  
  <p>I can create a function like this:</p>
  
  <pre><code>function insert_datetime {
    while read line
    do
      printf "$line"
      date '+ %m-%d-%Y %H:%M:%S'
    done
  }
  </code></pre>
  
  <p>then call vmstat as below:</p>
  
  <pre><code>'vmstat 3 5 | insert_datetime'
  </code></pre>
  
  <p>but this line puts date time to every line, including dashes (--) and any rows that has text. How can I exclude rows that has dahses and text?</p>
  
  <pre><code>kthr    memory              page              faults              cpu 04-23-2013 10:19:49
  ----- ----------- ------------------------ ------------ ----------------------- 04-23-2013 10:19:49
  r  b   avm   fre  re  pi  po  fr   sr  cy  in   sy  cs us sy id wa    pc    ec 04-23-2013 10:19:49
  0  0 45688088 4094129   0   0   0   0    0   0  45 12172 2840  1  1 99  0  0.35   2.2 04-23-2013 10:19:49
  2  0 45694135 4088082   0   0   0   0    0   0 451 56350 21818  3  1 97  0  0.73   4.5 04-23-2013 10:19:52
  1  0 45694137 4088061   0   0   0   0    0   0 303 24568 951  3  1 96  0  0.82   5.1 04-23-2013 10:19:55
  1  0 45694138 4087739   0   0   0   0    0   0 445 9170 1504  2  0 98  0  0.64   4.0 04-23-2013 10:19:58
  4  0 45703145 4078732   0   0   0   0    0   0 335 47175 1306  4  1 95  0  1.01   6.3 04-23-2013 10:20:01
  </code></pre>
  
  <p>I needed to look like this:</p>
  
  <pre><code>kthr    memory              page              faults              cpu
  ----- ----------- ------------------------ ------------ ----------------------- 
  r  b   avm   fre  re  pi  po  fr   sr  cy  in   sy  cs us sy id wa    pc    ec 
  0  0 45688088 4094129   0   0   0   0    0   0  45 12172 2840  1  1 99  0  0.35   2.2 04-23-2013 10:19:49
  2  0 45694135 4088082   0   0   0   0    0   0 451 56350 21818  3  1 97  0  0.73   4.5 04-23-2013 10:19:52
  1  0 45694137 4088061   0   0   0   0    0   0 303 24568 951  3  1 96  0  0.82   5.1 04-23-2013 10:19:55
  1  0 45694138 4087739   0   0   0   0    0   0 445 9170 1504  2  0 98  0  0.64   4.0 04-23-2013 10:19:58
  4  0 45703145 4078732   0   0   0   0    0   0 335 47175 1306  4  1 95  0  1.01   6.3 04-23-2013 10:20:01
  </code></pre>