Hey, i found this one in the forum...
it works, but don't remove the "\" after the searched word...
$oldword contains the word who should be deleted....
$list = "data.txt";
$results = file($list);
$newword = "";
while (list(,$path) = each($results)){
$parts = explode(':', $path);
$path = $parts[0];
$fp = fopen("$list", 'r');
if ($fp){
$data = fread($fp, filesize($list));
fclose($fp);
$newdata = str_replace($oldword, $newword, $data);
$fp = fopen($list, 'w');
if ($fp){
fwrite($fp, $newdata);
fclose($fp);
}
}
}
If I use my version incl. the removing of
the "\n" all "\n"'s in the file will be removed :-(