date: extra operand %d' error
<p>I have a text log file, the format is like the following</p>

<pre><code>Thread-28689296: Thu Aug 25 15:18:41 2016 [ info ]: xxxxx xxxxxx xxxxx
</code></pre>

<p>So I want to run cron job to find some certain error messages in last a few minutes. I wrote the following command </p>

<pre><code>awk -vDate=`date +%b %d %H:%M:%S %Y` -vDate2=`date --date="2 minutes ago" +%b %d %H:%M:%S %Y` '$5 &gt; Date &amp;&amp; $5 &lt; Date2' /var/log/dummy.log  | grep "Fatal"
</code></pre>

<p>In the above command, i search for messages that have a timestamp beween time now and 2 minutes ago with a string <code>Fatal</code>.</p>

<p>But I got the following error </p>

<pre><code>date: extra operand %d'
Try date --help' for more information.
date: extra operand %d'
Try date --help' for more information.
</code></pre>

<p>If I run date commands, I got the results as the following</p>

<pre><code>date "+%b %d %H:%M:%S %Y"
Aug 25 15:25:01 2016

date --date="2 minutes ago" +"%b %d %H:%M:%S %Y" 
Aug 25 15:31:42 2016
</code></pre>

<p>So the date commands in my awk script should be okay. </p>

<p>I also want to redirect the found error messages happening 2 minutes to a file to mail as alert but I did not get that far yet.</p>

<p>Please kindly advice me what is wrong in my awk script. Thanks a lot in advance!</p>