Re: getting one line from file
| From: | Web Admin | Date: | Thu, 31 Aug 2000 13:36:20 +0000 |
| Subject: | Re: getting one line from file | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-14591@lists.php.net to get a copy of this message | ||
Hey pac,
i suggest you to export all your information into a sql
server. This amount of data is really big to be stored
into a text file!! :)
Ahmad Anvari
----- Original Message -----
From: "Michael Packer" <pac@stingrayboats.com>
To: "Chris Murley" <murley@appindex.net>
Cc: "Robin Vickery" <robin@planet-three.co.uk>; <php-general@lists.php.net>
Sent: Thursday, August 31, 2000 6:02 PM
Subject: RE: [PHP] getting one line from file
>
> 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
>
>
> >
> > how big is the file your reading?
> >
> > How beefy is your webserver?
> >
> > Is this file one line? if so why grep? thats overhead you dont need?
> > just open the file, and put the whole thing into any array, then access
> > what you need. It will probally be quicker then doing a system call, and
> > using grep tooo, , all that causes overhead. on the other hand if this
> > file is a big one, that will wlos you down to.
> >
> > On Thu, 31 Aug 2000, Michael Packer wrote:
> >
> > >
> > > > pac@stingrayboats.com ("Michael Packer") writes:
> > > >
> > > >> I'm just learning PHP and have a question....in perl I used
> > to do this:
> > > >>
> > > >> $info =
grep "676"
> > > >> /tmp/somefile.txt;
> > > >> (i know there was only one line in the file with that number,
> > > >>thats why it's not @info)
> > > >>
> > > >> i need to only get one line out of this file that is very large
> > > >>(which is why i don't want to open it read through the file
> > until i find
> > > >>the correct line)...
> > > >
> > > > try this: :-)
> > > >
> > > > $info = grep "676" /tmp/somefile.txt;
> > >
> > >
> > > well i tried this..it works, but damn it take a performance
> > hit...do system
> > > calls rereally effect PHP that much?
> > >
> > > instead of instantly loading, it now takes about 2-3 seconds
> > >
> > > any other ideas?
> > >
> > > thanks!
> > > pac
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > > For additional commands, e-mail: php-general-help@lists.php.net
> > > To contact the list administrators, e-mail:
php-list-admin@lists.php.net
> > >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>