Uite o idee

Cod PHP:
$keyword "masini";
$gasit false;
$txt fopen("cautari.txt","r");
while (!
feof($txt)){
$line fgets($txt);
if (
preg_match("/".$keyword."/",$line)) {
$gasit true;
}

Daca $gasit returneaza false -> scrii in fisier.