RE: [PHP] getting one line from file
| From: | David Perry | Date: | Thu, 31 Aug 2000 14:40:44 +0000 |
| Subject: | RE: [PHP] getting one line from file | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-14619@lists.php.net to get a copy of this message | ||
Michael,
> > > >> $info =
grep "676"
> > > >> /tmp/somefile.txt;
There are some minor tricks to help like
$info = `cat /tmp/somefile.txt | head -9000 | grep '676';
but you would really be much better off putting 10 meg into a db engine
and index the dickens out of it. WIth only 10k records your response time
should be way < 1 second.
--David Perry
On Thu, 31 Aug 2000, Michael Packer wrote:
> The text file i'm search is 9,859,103 bytes (today, it will be a bit larger
> tomorrow)
> (30,072 lines)
>
> generally the line i'll be looking for is in the first 9,000 or so lines...
> the web server that i'm doing this on is dual p3 500 with 512mb
>
> i'm only looking for the one line that contains a specific number (and i
> know for a
> fact that the number will not (ever) be duplicated in another line.
>
> pac