Vernon Webb wrote:
I'm trying to find a way to search text files in a directory using php. I've
done some researching under the filesystem section on php.net but seem to
have come up empty handed. Is there a way to do keyword searches on a txt
file in a directory hopefully with some type of relevance ranking?

If you are on a unix system, you can just grep for the matches and then count the results. Send grep the list of files as input with your "keyword" -- and (I forget which option of grep it is man grep) grep will return the number of matches.


Will probably be faster than reading each file using PHP.

--
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com
-----------------------
"Documentation is like sex: when it is good,
 it is very, very good; and when it is bad,
 it is better than nothing."

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to