title: gawk / awk: piping date to getline *sometimes* won't work
body: <p>I'm attempting to convert dates from one format to another:
  From e.g. "October 29, 2005" to 2005-10-29.
  I have a list of 625 dates. I use Awk.</p>
  
  <p>The conversion works -- most of the time.
  Hovewer, sometimes the conversion won't happen at all,
  and the variable supposed to hold the (converted) date remains
  undefined.</p>
  
  <p>This always happens with the exact same rows.
  Running `date' explicitly (from the Bash shell) on the dates
  of those weird rows works fine (the dates are properly converted).
  -- It's not the textual contents of those rows that matters.</p>
  
  <p>Why this behavior, and how can I fix my script? <br />
  Her it is:</p>
  
  <pre><code>awk 'BEGIN { FS = "unused" } { 
    x = "undefined";
    "date \"+%Y-%m-%d\" -d " $1 | getline x ;
    print $1 " = " x
  }' uBXr0r15.txt \
   &gt; bug-out-3.txt
  </code></pre>
  
  <p>If you want to reproduce this problem:</p>
  
  <ol>
  <li>Download this file: <a href="http://pastebin.com/uBXr0r15" rel="noreferrer">uBXr0r15.txt</a>.</li>
  <li>Run the Awk skript.</li>
  <li>Search for "undefined" in bug-out-3.txt.<br>
  ("undefined" found 122 times, on my computer.)</li>
  </ol>
  
  <p>Then you could run the script again, 
    and (on my computer) bug-out-3.txt remains
    unchanged -- exactly the same dates are left undefined.</p>
  
  <p>(Gawk version 3.1.6, Ubuntu 9.10.)</p>
  
  <p>Kind regards, Magnus</p>