php grep



i am looking for a way to grep through a LARGE text file quickly and
efficiently. i need to pull out just one line of the file. i have found
the most efficient method so far to be:

$handle = popen('grep regex /path/to/file.txt', 'r');
$output = fread($handle, 2096);
pclose($handle);

i have used most other methods of reading text in php, but they have
proved to be very inefficient, and security is a major issue. any help
with this subject will be much appreciated.

.



Relevant Pages