Flat file parsing issue.


I am having a flat file which contains order detail and item details in a single row. Even if order having multiple items in a cart, order detail will repeats in each line.

Now i want to parse this file in a such way that, if there is any error on any line then i should be able to seprate out whole order( i mean if one order contains 5 itmes in cart then there will be total 5 lines in the flat file belonging to this order. Suppose 2nd line is missing some mandetory data then i want to remove these lines from my list and want to add in a separate exception list so that i can email those complete orders back to customers.