For this task, you should really use Regular Expressions. There aren't any regular expression parsers built into standard c++, so you will need to install a library. Boost has a good one that I know of, but there are others.
Now, you might be saying, "screw that, regular expressions seem too hard!" However, believe me that when you are facing complicated data, you want to use a flexible, pattern-matching technique. Regular expressions are the best and easiest way to look for specific text patterns in a heap of crazy data.
If you were open to other languages, you might check out Python for this task. Python manages text files better and simpler (in my opinion), and it has built in regular expression functionality.
Another alternative is to use a Finite State Machine to match the expression yourself. You would build the FSM in code, and use it to parse input. This will not be easy, but it will also work well.
In any case, I would suggest that you don't re-invent the wheel. Find yourself a library that can parse the patterns and use it.