in reply to while question

Hope I understood your problem, but if I did, then the easiest way would be to match for the '|' which would exclude the last line....
Just a thought..