Archive: Inserting lines in text file


Inserting lines in text file
Hi,

I've seen a number of utilities for editing files, but none have been exactly what I wanted. Can anyone recommend the easiest way to insert new lines into a text file?

Ideally, I need to be able to do a find to locate the position where I want to insert (this worked fine), then insert the line. The filewrite commands seem to overwrite whatever is in the file at the location, rather than inserting there. Other things I found all wanted to replace something that was already there.

Did I miss something?

Recommendations?

Thanks!
Stan


Yep. Now you are seeing what I saw in the past... The only way to insert a text now is:

1) Create a new file.
2) Get text from the old and write in the new file. Repeat for every char on the file.
3) When a text you want to insert is found, insert the text found in the new file with the new text. Go to Step 2.

The problem is, besides problems writing text, have problems reading it too: if you get a null character, sets an error, because the command thinks it is the end of the file.