How to deal with "Previous message repeated 2 times"


Wonder if anyone can advise how to deal with processing an erro log file which can be broken down easily into fields, however there is the occasional line such as:

"Previous message repeated X times", where X is a number

How would I best approach buffering the previous line, and then just repeating it X times when I get such a message.

Any tips or similar examples very much appreciated.