in reply to Stripping Lines out of a File

Without seeing some data I may be off, but the approach I'd take is to gather each block of lines in an array. When you hit the last piece of a block you check for your match condition and conditionally write or don't write the accumulated block to output. Gathering/recognition of blocks is done by matching the tags you give above.