Page 1 of 1

Delete just part of a text file

Posted: Wed Aug 20, 2003 10:02 am
by like_duh44
I'm making a script for the non-mysql users. Before, I would user mysql's DELETE and UPDATE, but now I have a script to read a file. How would i get about deleting just one line of a text file, not knowing the line number, or how many bytes of data until that point, just what the string is thats is to be deleted?

Also, the update function for a text file? If there isnt one, could I just have it delete those few lines and insert new ones with the updated values?

Posted: Thu Aug 28, 2003 9:16 am
by JAM
You could use file() to read the file into an array.
After that being done, you can loop the different array-values, find the one you need to remove/update, and do it.

Hope I was clear enough.