title: Count data from the logs
body: <p>I have a log file with the format as bellow:  </p>
  
  <pre><code> 1: 2017-01-17 00:00:00,723 - [INFO] gid: 123456787  type: A
   2: 2017-01-17 00:00:00,727 - [INFO] gid: 123456787  Trans: 178
   3: 2017-01-17 00:00:00,729 - [INFO] gid: 123456788  type: B
   4: 2017-01-17 00:00:00,731 - [INFO] gid: 123456788  Trans: 121
   5: 2017-01-17 00:00:00,751 - [INFO] gid: 123456789  type: C
   6: 2017-01-17 00:00:00,771 - [INFO] gid: 123456790  type: D
   7: 2017-01-17 00:00:00,787 - [INFO] gid: 123456790  Trans: 121
   8: 2017-01-17 00:00:00,778 - [INFO] gid: 123456791  type: C
   9: 2017-01-17 00:00:00,789 - [INFO] gid: 123456791  Trans: 150
  </code></pre>
  
  <p>My goal is count total of Trans group by type. My idea is merge every 02 rows and then grep with  keywords of types.</p>
  
  <pre><code>$ cat logfile.txt |awk 'ORS=NR%2?FS:RS'|grep A 
  2017-01-17 00:00:00,723 - [INFO] gid: 123456787  type: A 2017-01-17 00:00:00,727 - [INFO] gid: 123456787  Total: 178
  
  $cat logfile.txt |awk 'ORS=NR%2?FS:RS'|grep C
  2017-01-17 00:00:00,751 - [INFO] gid: 123456789  type: C 2017-01-17 00:00:00,771 - [INFO] gid: 123456790  type: D
  </code></pre>
  
  <p>The expected output:   </p>
  
  <pre><code>$ cat logfile.txt |awk 'ORS=NR%2?FS:RS'|grep B|awk '{sum+=$16} END {print sum}
  121
  </code></pre>
  
  <p>Unfortunately the logs is including the rows of <code>type</code> without the next row of <code>Trans</code> (row 5). </p>
  
  <p>Any idea to help me to complete my goal. </p>