title: Comparing variables in awk
body: <p>My file has timestamps in its 6th field which looks like this: <strong>Mon Jul 7 14:53:16 PDT 2014</strong></p>
  
  <p>I want to get all those lines from this file whose 6th field <strong>values are within the last 24 hours</strong>.  </p>
  
  <p><strong>Sample Input:</strong></p>
  
  <pre><code>abc -&gt; /aa/bbb, hello, /home/user/blah.pl, 516, usc, Mon Jul 4 10:06:33 PDT 2014
  abc -&gt; /aa/bbb, hello, /home/user/blah.pl, 516, usc, Mon Jul 5 10:06:33 PDT 2014
  abc -&gt; /aa/bbb, hello, /home/user/blah.pl, 516, usc, Mon Jul 7 07:06:33 PDT 2014 
  abc -&gt; /aa/bbb, hello, /home/user/blah.pl, 516, usc, Mon Jul 7 08:06:33 PDT 2014
  abc -&gt; /aa/bbb, hello, /home/user/blah.pl, 516, usc, Mon Jul 7 09:06:33 PDT 2014
  abc -&gt; /aa/bbb, hello, /home/user/blah.pl, 516, usc, Mon Jul 7 10:06:33 PDT 2014
  </code></pre>
  
  <p>The field delimiter is comma.</p>
  
  <p><strong>Sample Code</strong>
  But it's not working as expected: </p>
  
  <pre><code>awk 'BEGIN {FS = ","};
  { a=$6;
  aint=a +"%y%m%d%H%M%S";
  yestint=$(date --date='1 day ago' +"%y%m%d%H%M%S");
  if (aint&gt;yestint)
  print aint;
  }' /location/canzee/textfile.txt
  </code></pre>
  
  <p><strong>Sample Output</strong>
  I get an output like this:</p>
  
  <pre><code>awk: cmd. line:4: yestint=$(date --date=1
  awk: cmd. line:4:                      ^ syntax error
  awk: cmd. line:5: (END OF FILE)
  awk: cmd. line:5: syntax error
  </code></pre>
  
  <p><strong>Desired Output</strong>  </p>
  
  <pre><code>Mon Jul 7 07:06:33 PDT 2014
  Mon Jul 7 08:06:33 PDT 2014
  Mon Jul 7 09:06:33 PDT 2014
  Mon Jul 7 10:06:33 PDT 2014
  </code></pre>
  
  <p>I would like to know how to go about this if I can't call shell commands like date within awk command. I hope its clear enough.</p>