[PHP] delete lines from text file

2003-06-05 Thread Matt Palermo
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. Also keep this line. Delete this line. Keep this one too.

RE: [PHP] delete lines from text file

2003-06-05 Thread Martin Towell
] delete lines from text file 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. Also keep this line. Delete

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. Also

Re: [PHP] delete lines from text file

2003-06-05 Thread Hugh Danaher
the file, open it again for writing, write the text to the file, and then close it. Hope this helps, Hugh - Original Message - From: Matt Palermo [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, June 05, 2003 8:53 PM Subject: [PHP] delete lines from text file Can anyone help me

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] delete lines from text file Matt, Try something like

[PHP] # of lines in a file

2002-12-09 Thread Clivus2k1
Hey guys, I've been searching the manual for a way to grab the number of lines in a file and read a particular line from it, however I found no solution to my problem so I'm wondering if any of you out there could help me :-) - CS

Re: [PHP] # of lines in a file

2002-12-09 Thread John Nichel
You could try... $file = ( /path/file.ext ); $lines = sizeof ( $file ); [EMAIL PROTECTED] wrote: Hey guys, I've been searching the manual for a way to grab the number of lines in a file and read a particular line from it, however I found no solution to my problem so I'm wondering if any of

Re: [PHP] # of lines in a file

2002-12-09 Thread Adam Voigt
$f = fopen(filename,r); $data = "" fclose($f); $data = "" $lines = count($data); $certainline = $data[linenumberyouwant]; Replace filename in both places, and linenumberyouwant. On Mon, 2002-12-09 at 11:58, [EMAIL PROTECTED] wrote: Hey guys, I've been searching the

RE: [PHP] # of lines in a file

2002-12-09 Thread John W. Holmes
Hey guys, I've been searching the manual for a way to grab the number of lines in a file and read a particular line from it, however I found no solution to my problem so I'm wondering if any of you out there could help me file() will read the file into an array, one line per element, so...

Re: [PHP] # of lines in a file

2002-12-09 Thread Ray Hunter
Might not be the most secure way, but very fast... $lines = `cat file.txt | wc -l` That will give you the number of lines...but again not the best method... On Mon, 2002-12-09 at 09:58, [EMAIL PROTECTED] wrote: Hey guys, I've been searching the manual for a way to grab the number of lines