to search the text file, load it all into a string...
then you can do regular expressions on the string.... like
ereg("blah",$file_contents)
would only be true if the "blah" appeared in the string.
that is very simple and won't probably produce the results you want. you can tweak with it a lot to narrow down the results set.