Re: [PHP] delete lines from text file

2003-06-05 Thread Hugh Danaher
My bad: while (!feof($fp)) instead of what I wrote earlier. - Original Message - From: "Hugh Danaher" <[EMAIL PROTECTED]> To: "Matt Palermo" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Thursday, June 05, 2003 10:59 PM Subject: Re: [PHP] delet

Re: [PHP] delete lines from text file

2003-06-05 Thread Hugh Danaher
Matt, Try something like: I didn't check this before posting so there could be some syntax issues, but the flow is what you need. Open a file for reading, read it line by line to find a text phrase, accumulate the lines (less the one with the phrase) in a new variable, close the file, open it aga

Re: [PHP] delete lines from text file

2003-06-05 Thread R'twick Niceorgaw
On Thursday 05 June 2003 11:53 pm, Matt Palermo wrote: > Can anyone help me figure out how to search for a string in a text file, > then delete the whole line of text that it occurs in? > > For example: I have a text file which contains the following. > > //** text.txt ** > Keep this line.

RE: [PHP] delete lines from text file

2003-06-05 Thread Martin Towell
I think you'll have to read the file manually (file() would prob be the best bet) and manually find/delete the line and then rewrite the file. Martin -Original Message- From: Matt Palermo [mailto:[EMAIL PROTECTED] Sent: Friday, June 06, 2003 1:54 PM To: [EMAIL PROTECTED] Subject: [PHP] de