RE: [PHP] Parsing large file
| From: | Pablo Gosse | Date: | Tue, 31 Aug 2004 19:15:40 +0000 |
| Subject: | RE: [PHP] Parsing large file | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-195325@lists.php.net to get a copy of this message | ||
Adrian Teasdale wrote:
> Hi there
>
> We have a text file that is 2.2gb in size that we are trying to parse
> using PHP to put the content into a mysql database. This file
> contains 40 million individual lines of data. Basically PHP isn't
> parsing it. Any suggestions of how we could do this?
>
> Thanks
>
> Ade
Use split to break the file down into parts of manageable size, and then
process those.
split -b nM <filename> (where n is the number of Megs you wish each part
to be).
man split
HTH.
Pablo