aamir_faried
14th January 2010, 15:56
Is there any way to delete a character from a file like we have seq.putc$() that is used to put character in file.

thanks

george7a
14th January 2010, 16:09
One way is to read the whole file using seq.gets() and write it again to another file using seq.puts. Keep doing that process until you reach the line that you need to edit, edit it and continue.

- George

mark_h
14th January 2010, 17:54
In one case we had a program that wrote a sed or awk script then launched it to delete/edit the text.

aamir_faried
14th January 2010, 19:02
could you please explain how can i do it "In one case we had a program that wrote a sed or awk script then launched it to delete/edit the text."

NPRao
14th January 2010, 21:46
could you please explain how can i do it "In one case we had a program that wrote a sed or awk script then launched it to delete/edit the text."
Aamir,

If you are on Linux (or any Unix) you can use the operating system's utilities.

A simple example of sed to find and replace patterns (Hello to Goodbye) in file -

$ sed -e "s/Hello/Goodbye/g" input_file > output_file
$ mv output_file input_file

If you like to keep it platform neutral then you should go with George's suggestion and use find.and.replace() function. You can use search on the forum for its usage.