php-general | 2000071

Re: [PHP] Data Overload From: Jonas Jochum (320023873043-0001 <email protected>)
Date: 07/02/00

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am 02.07.00 um 21:03 hat Cynic geschrieben:

C>I can't see why PHP shouldn't be able to handle this file.
C>Can you send in your script?
C>>See, I have this file: http://www.nozonenet.com/users.txt
C>>and I need to sort all of those users into different files, according to
C>>there domains (after the @ but before the tab)... only problem is that PHP
C>>can not handle that big of a file, at least I can't make it work with it...
C>>can someone please give me a idea on how to write this.. like a framework or
C>>something.. I am on a schedule and this is bugging me like heck... (our
C>>server just got hacked, and I need to insert all of these users back into
C>>the server, if I did it like it is now I would be working for weeks)...

That shouldn't be a problem.
$fp[0] = fopen("hugefile","r");
$fp[1] = fopen("littlefile","r");

while (!feof($fp[0]))
{
        $line = fgets($fp,1024);
        if (ereg("foo\tbar",$line))
                fputs($fp[1],$line);
}

Well, something like this *should* work. You might also want to increase
the timeout value in your php.ini. If the file is really that huge, the
default value won't be sufficient. Actually, why don't you use perl for
it...?

- --
MfG,
   Jonas Jochum

commandline net services
- -------------------------------------------------------------------------
tel: 07223-911794 | cmd:~ # Systemadministration, Netzwerkverwaltung
fax: 07223-911795 | cmd:~ # Einrichtung von *BSD/Linux-Servern
d2 : 0173-5712481 | cmd:~ # Datenbank/Internetprogrammierung
jj <email protected> | cmd:~ # Webdesign
www.commandline.de |
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.1 (FreeBSD)
Comment: Made with pgp4pine

iEYEARECAAYFAjlfnUEACgkQF1ki3orczCA+JgCgkMG5somRBaltiM5oaSH4e9pR
sUcAnA7/8/VJPERHvF5MSKBcAI/5ZLUk
=a6/y
-----END PGP SIGNATURE-----

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe <email protected>
For additional commands, e-mail: php-general-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>