title: How to add date string to each line of a continuously written log file
body: <p>Having a long running program that continuously writes to a logfile - how is it possible, disregarding any buffering issues, to add a date string to each line written to that file using a linux script?</p>
  
  <p>I would imagine something like this:</p>
  
  <pre><code>tail -f logfile | ADD_DATE_TO_EACH_LINE &gt; logfile2
  </code></pre>
  
  <p>The input would be something like that:</p>
  
  <pre><code>abc
  def
  ghi
  jkl
  </code></pre>
  
  <p>The output should be similar to that:</p>
  
  <pre><code>2011-06-16 18:30:59 abc
  2011-06-16 18:31:00 def
  2011-06-16 18:35:21 ghi
  2011-06-16 18:40:15 jkl
  </code></pre>