title: SCALA word count in groups
body: <pre><code>2018-03-22 04:26:29.0 PM:
  Daemon:
  Timed Out Connections:
  Live Connections:
  Live Audio/Video Connections:
  SIPB:124340495361123111@127.0.0.1:7
  SIPB:124340495361123111@127.0.0.1:4
  SIPB:124340495361123111@127.0.0.1:2
  SIPB:124340495361123111@127.0.0.1:6
  
  2018-03-23 08:05:12.0 AM:
  Group Dump:
  2018-03-23 08:05:42.0 AM:
  2018-03-23 08:05:45.0 AM:
  SIPB:7827214454065563030@127.0.0.1:3
  SIPB:7827214454065563030@127.0.0.1:2
  SIPB:7827214454065563030@127.0.0.1:1
  
  2018-03-22 04:34:49.0 PM:
  Daemon:
  Timed Out Connections:
  Live Connections:
  Live Audio/Video Connections:
  SIPB:124340495361123111@127.0.0.1:7
  SIPB:124340495361123111@127.0.0.1:4
  SIPB:124340495361123111@127.0.0.1:2
  SIPB:124340495361123111@127.0.0.1:6
  </code></pre>
  
  <p>From the above sample data , i need to count the no of times <code>SIPB:7827214454065563030@127.0.0.1:3</code> word has occurred for a particular date which can be grouped under <code>Live Connections</code> 
   Also i need to print the date time stamp  of the same group. 
  I have the logiC on how to count them in total , but the question is how to count them in groups and print the line that is 3 lines back to string <code>Live Connections:</code>
  The SIPB group under <code>Group Dump</code> is not to be conunted and removed . </p>
  
  <p>Like the resulting o/p should be like this ,</p>
  
  <p><em>O/P</em></p>
  
  <pre><code>2018-03-22 04:26:29.0 PM:
  4
  2018-03-22 04:34:49.0 PM:
  4
  </code></pre>
  
  <p>Code I used to count no of <code>cat:</code> in total </p>
  
  <pre><code>val lines = Source.fromFile("/home/kafka/Downloads/newdump.txt").getLines().filter(!_.isEmpty()).mkString  
  dictionary = Map( """cat:""" -&gt; 1)
  val res = dictionary.map { case(k,v) =&gt; k -&gt; k.r.findAllIn(lines).size }
  </code></pre>