in reply to Removing lines from a file.

Go with two files, the original, and a scratch file. Read in from the original and just print that line out to the scratch file unless it's a line you're interested in. Mangle as appropriate (or ignore) if you are interested, and print out to scratch file. When you're all done, copy the scratch file over the original. Make backups beforehand as appropriate =)

Philosophy can be made out of anything. Or less -- Jerry A. Fodor