I am trying to write a program which would compare contents of lines within a file. The text file that I have is very big. A sample of this is below. The first field is time. What I want to do is to
1. take in as input the time and the second column(full line). increment a counter. move to the next line and do the same.
2. scan the second line, if the time is within 5 seconds, the same data appears again, then dont increment the counter. If it is after 5 seconds, increment it.
3. Run till end of the file and throw output on number of unique pairs for the entire file (ie unique pairs seperated by more than 5 seconds).
here is the sample input:
I am clueless on how to handle this. Previously I was using awk to do this but it takes too much time to run. My knowledge of C is limited. Please give me a starting point to tackle this issue.
Thanks in advance.