title: AWK Unexpected token error
body: <p>I came up with the below script to list out calls which take longer than  10000000 microseconds (ServiceDuration in our logs has value logged in microseconds) from the server log file which stores all calls coming to the service. </p>
  
  <p><strong>servicedurationlimit.awk</strong></p>
  
  <pre><code>#!/bin/sh
  dir1=$1/*.log
  
  # for each log file in the input dir
  for file1 in $dir1
  do
          echo $file1":"
          awk  '/#BeginLogEntry|ServiceDuration/ {
                  #get slow running service's information
                  if ($1 == "#BeginLogEntry")
                  {
                          split($0, a, "\t");
                          servinfo=a[3]" ServiceAt:"a[2];
                  } else {
                          getline;
                          if ($0 &gt; 10000000)
                          {
                                  print servinfo", ServDur:"$0
                          }
                  }
          }' $file1
  done
  </code></pre>
  
  <p>On running the script I get below error:</p>
  
  <pre><code>./servicedurationlimit.awk /path/to/server/logs/
  ./servicedurationlimit.awk: line 12: syntax error near unexpected token `$0,'
  ./servicedurationlimit.awk: line 12: `                  split($0, a, "\t"); '
  </code></pre>
  
  <p>Can you please help me understand what could be causing this? </p>
  
  <p>Below is the sample log file (which has 2 log entries):</p>
  
  <pre><code>#BeginLogEntry  04.13 20:11:11.671  BROWSE_ALL
  @Properties LocalData
  IsJson=1
  UserTimeZone=utc
  @end
  @IdcRSet AuditProps
  2
  auditPropertyKey
  auditPropertyValue
  ServiceDuration
  62818
  ServiceStartTime
  {ts '2015-04-13 20:11:11.671'}
  @end
  #EndLogEntry    04.13 20:11:11.671  BROWSE_ALL
  #BeginLogEntry  04.13 21:12:11.671  BROWSE_SOME
  @Properties LocalData
  IsJson=1
  UserTimeZone=utc
  @end
  @IdcRSet AuditProps
  2
  auditPropertyKey
  auditPropertyValue
  ServiceDuration
  162818123
  ServiceStartTime
  {ts '2015-04-13 21:12:11.671'}
  @end
  #EndLogEntry    04.13 21:12:11.671  BROWSE_SOME
  </code></pre>
  
  <p>Below is the output I am expecting after running the script on log file containing above log entries.</p>
  
  <pre><code>BROWSE_SOME ServiceAt:04.13 21:12:11.671, ServDur: 162818123
  </code></pre>
  
  <p><strong><code>awk</code> Version information</strong> </p>
  
  <pre><code>$ awk --version
  GNU Awk 3.1.5
  </code></pre>