In Ruby Compare 2 lines in a log file which BOTH contain the SAME "WORD" but ONLY print out the line

Posted by kamal on Stack Overflow See other posts from Stack Overflow or by kamal
Published on 2010-05-03T03:43:01Z Indexed on 2010/05/03 3:48 UTC
Read the original article Hit count: 261

Filed under:
|
|

here are sample lines

Apr  9 11:53:26 skip [2244]: [2244] ab-cd-ef:cc [INFO] A recoverable error has occurred
some other log lines ..
....
Apr  9 12:53:26 skip [2244]: [2244] ab-cd-ef:cc [INFO] A recoverable error has occurred

now the LATEST line would have to be one with the latest Date String, and THAT is the one that needs to be printed, plus the NEXT time the parser runs on the log file, somehow the previous LATEST line has to be compared with the Existing latest one, and it CAN e the case, that NOTHING Changed and the OLD line is STILL the latest one, OR there is a NEW line, but ONLY the NEW log line should be printed and NOT if there is NO NEW log Entry.

© Stack Overflow or respective owner

Related posts about ruby

Related posts about parsing