title: Counting lines in a file during particular timestamps in bash
body: <p>I am scheduling a cron that runs every minute and gives the word count of <code>REJECT</code> for every minute. My file is logged continuously and to avoid redundant read, I store the lines I read last time while running the script using tail -n +lastTimeWC. But how do I count number of REJECT per minute. sample input:</p>
  
  <pre><code>20170327-09:15:01.283619074 ResponseType:REJECT
  20170327-09:15:01.287619074 ResponseType:REJECT
  20170327-09:15:01.289619074 ResponseType:REJECT
  20170327-09:15:01.290619074 ResponseType:REJECT
  20170327-09:15:01.291619074 ResponseType:REJECT
  20170327-09:15:01.295619074 ResponseType:REJECT
  20170327-09:15:01.297619074 ResponseType:REJECT
  20170327-09:16:02.283619074 ResponseType:REJECT
  20170327-09:16:03.283619074 ResponseType:REJECT
  20170327-09:17:02.283619074 ResponseType:REJECT
  20170327-09:17:07.283619074 ResponseType:REJECT
  </code></pre>
  
  <p>Expected Output:</p>
  
  <pre><code>9:15 REJECT 7
  9:16 REJECT 2
  9:17 REJECT 2
  </code></pre>
  
  <p>Update1: (Using Ed Morton's answer)</p>
  
  <pre><code>#!/usr/bin/bash
  while :
  do
  awk -F '[:-]' '{curr=$2":"$3} (prev!="") &amp;&amp; (curr!=prev){print NR, prev, $NF, cnt; cnt=0} {cnt++; prev=curr}' $1
  sleep 60
  done
  </code></pre>
  
  <p>This script continuously gives me output after 60 seconds. But it should only give new timestamps added to the logfile <code>($!)</code> Suppose 9:18 gets added, then it should just start including that to the answer (not 9:15 to 9:18 all again)</p>