From: Dave Thomas Date: 2002-07-15T14:36:48+09:00 Subject: Re: How to delete a line in a file if....? Kurt Euler writes: > Thanks Daniel. This looks like it would work. But I had in mind to > delete a line in an open file, then save the whole file, rather than > do conditional saving line-by-line to an out file. Maybe these are > really the same thing but just look different. Think of a file as simply a stream of characters on disk, with newline sequences separating the lines. aaaaabbbbbbbbbbbbccccccddddddddddddd If there is no higher-level structure, how would you do about deleting the line containing the b's? The simplest way is to copy the file, skipping the line to be deleted. (An alternative on some operating systems might be to compress the file in place, but that has a secondary problem: crash in the middle and your file is corrupt). Some operating systems (such as Multics) had line-oriented files, which allowed you to delete lines on disk files. Unix and DOS don't. Cheers Dave