Okay, if I understand everything correctly, something like this may work, if you can get around the issue of your file sizes being so large, and you can deal with the amount of memory this is going to eat up, and you realize that Perl is probably better suited to the job...
//read numbers $numbers = file("in.txt"); //read all lines from log file $fp = fopen("file.log","r"); $log_file = fread($fp,filesize("file.log")); //match lines of log_file that start with 'code' //and match number preg_match_all("/^(code.*number=([0-9]+).*)$/m",$log_file,$matches); //put matches into an array such as // $array[code] = number $x=0; foreach($mathes[1] as $code) { $number = $matches[2][$x++]; $log_file_array[$code] = $number; } //compute intersection of log file array //and numbers array $intersect = array_intersect($log_file_array,$numbers); //flip the log array, so you now have //an array full of the lines in the log //file that matches a number in the in.txt file $answer = array_flip($intersect); Hope that works... I can't test it. There are many ways you can do this... --John Holmes... ----- Original Message ----- From: "Didier McGillis" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, January 21, 2003 5:49 PM Subject: Re: [PHP] HELP HELP on a file parser > Sorry should have done this. > > in.txt (there will be 470 of these #'s) - it uses these numbers to check > against the chek.txt file > 455784 > 455785 > 455786 > 455787 > 455788 > > check.txt - after it checks this file where number=389487 a number from > in.txt, if it does it writes that to another file > not on q/n2 24 Sat Nov 12 00:27:34 2002 > 3 129 code=001;number=389487;name=Blah L > McBlah;type=5;big_number=888888888;time=09;min=2004; > > > found.txt gets written to either in this format > not on q/n2 24 Sat Nov 12 00:27:34 2002 > 3 129 code=001;number=389487;name=Blah L > McBlah;type=5;big_number=888888888;time=09;min=2004; > or this format > code=001;number=389487;name=Blah L > McBlah;type=5;big_number=888888888;time=09;min=2004 > > hope that helps. > > > >From: "1LT John W. Holmes" <[EMAIL PROTECTED]> > >Reply-To: "1LT John W. Holmes" <[EMAIL PROTECTED]> > >To: "Didier McGillis" <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> > >Subject: Re: [PHP] HELP HELP on a file parser > >Date: Tue, 21 Jan 2003 17:33:36 -0500 > > > > > I need some help, I think this is probably really simple and I was > >wondering > > > if anyone had some code I could use to help me write this. > > > > > > I need a page to parse a text file with a list of numbers, and then take > > > those numbers and parse another file with over 7MB of information and to > > > look for those numbers and then to pull out the matches. Now the file > >that > > > its looking through each record that has a number in it is in a specific > > > format with a beginnning and an end. > > > >Can you give a short example of each file and what you want to match in > >each? > > > >---John Holmes... > > > > > >-- > >PHP General Mailing List (http://www.php.net/) > >To unsubscribe, visit: http://www.php.net/unsub.php > > > _________________________________________________________________ > STOP MORE SPAM with the new MSN 8 and get 2 months FREE* > http://join.msn.com/?page=features/junkmail > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php