I need to delete an exact line from a text file but I cannot for the life of me workout how to go about doing this.
Any suggestions or examples would be greatly appreciated?
Related Questions
I need to delete an exact line from a text file but I cannot for the life of me workout how to go about doing this.
Any suggestions or examples would be greatly appreciated?
Related Questions
No rocket scien code require .Hope this simple and short code will help.
OR use this
One way to do it if the file is not very big is to load all the lines into an array:
What? Use file open, seek position then stream erase line using null.
Gotch it? Simple,stream,no array that eat memory,fast.
This work on vb.. Example search line culture=id where culture are namevalue and id are value and we want to change it to culture=en
that's all..use #d
If the line you want to delete is based on the content of the line:
Or if it is based on line number:
Are you on a Unix operating system?
You can do this with the "sed" stream editor. Read the man page for "sed"
Read and remember each line
Identify the one you want to get rid of
Forget that one
Write the rest back over the top of the file