Andreas Palm <ap***@hotmail.com> wrote:
I have the situation where I have a file in which there is one certain
line of text that I have to find and replace with another line of
text.
What is the simplest way to do this ?
There are two fairly simple solutions:
1) Read the whole file into memory, a line at a time. Modify the
appropriate line, then write the whole thing back. This clearly doesn't
scale well to large files.
2) Read the file a line at a time, writing it out to another file with
appropriate modifications.
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too