Re: searching through 2 text files
| From: | Torsten Roehr | Date: | Thu, 22 Jul 2004 14:30:07 +0000 |
| Subject: | Re: searching through 2 text files | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-191527@lists.php.net to get a copy of this message | ||
"Alantodd" <alantodd@gibhut.com> wrote in message
news:php.general-191525@news.php.net...
> I have 2 text files
>
>
>
> One has arp list
>
>
>
> IP Address MAC Address Type
>
> ---------------- ------------------ ----------
>
> 165.166.182.204 00:0a:04:98:b5:d3 dynamic
>
>
>
>
>
> One file has a mac list
>
>
>
> Modem MAC Address IP Address CPE IP Address CPE MAC
> Address CPE Source
>
> ----------------- ---------------
> ---------------- - ---------------- -----------
>
> 00:00:39:46:88:57 10.21.2.236 165.166.182.204
> 00:0a:04:98:b5:d3 Learned
>
>
>
>
>
>
>
> Just an example - there are about 5000 entries in each file (more in the
mac
> list)
>
>
>
> What I am trying to do is match the mac address from the arp file to a cpe
> Mac address in the Mac file and return modem Mac and ip address from Mac
> list.
>
>
>
> I can open the arp and set what I want to an array. But matching up is
where
> I hit a wall..
>
>
>
> Thanks for any help or at least a point in some direction
>
>
>
> Alan
Hi Alan,
I guess you'd have to read the second file into an array as well (line by
line) and then *for each* entry from the arp list loop through all entries
of the mac list and compare the values.
Have you considered putting the data into two MySQL tables? This would make
dealing with it much more comfortable.
Regards, Torsten Roehr