RE: [PHP] how to delete lines in a txt file using php.

2005-07-12 Thread babu
f ($handle)) { $buffer = fgets($handle, 8192); if (substr($buffer,0,1)!=='[' && substr($buffer,0,3)!=='TYP'){ $hf = fopen($target, 'a'); fwrite($hf, $buffer); fclose($hf); } } fclose ($handle); That should do the trick. George > -Original Message---

Re: [PHP] how to delete lines in a txt file using php.

2005-07-11 Thread Richard Lynch
On Mon, July 11, 2005 4:13 pm, babu said: > $f=fopen($file,"w"); http://php.net/fopen "w" will open the file for WRITING, a fresh, new, EMPTY file. You want "r+" or "a+" or "w+" or something similar. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.p

[PHP] how to delete lines in a txt file using php.

2005-07-11 Thread babu
Hi i have a txt file like [SUBSTRAT] TYP=25x25_10 SUBSTRATNAME=S112 PIXEL=5 OPERATOR=Zi KOMMENTAR=dunkel INTENSITAET=1000.00 [MESSUNG] DATUM=03.01.2005 UHRZEIT=11:22 MESSUNG=SWEEP_UI i want to delete lines which start with '[' and 'TYP'. i have multiple such files.i have used strstr method.