OK, say the name of the file is products.txt, here is what we do:
$datafile="produts.txt";
$file=file($datafile);
while(list(,$value)=each($file)){
list($prod)=split( "\n", $value);
$oldword="eggs"
$newword="";
$fp = fopen($datafile, "r");
$data = fread($fp, filesize($datafile));
fclose($fp);
$newdata = str_replace($oldword, $newword, $data);
$fp = fopen($datafile,"w");
fwrite($fp,$newdata) or die ("error writing");
fclose($fp);
}
This should delete ALL instances of "eggs" in your file. I have code similar to this on my webpage but I havn't tried erasing stuff with it! Hope this helps!
~ Eric
123 Make Me! (http://123-makeme.com)