Help cross-referencing files

Gerald Combs gerald at ethereal.com
Mon Apr 18 11:12:39 CDT 2005


Brad wrote:
> Hi all,
> 
> I have 3 files each of which are space delimited sets of data.  I have
> to cross-reference these files to get one set of data at the end.  The
> first file maps IP Address to Cisco ATM interface, the second maps IP
> Address to MAC Address, and the third maps Cisco ATM interface to actual
> VPI and VCI.  I need to map MAC Address to VCI/VPI.  Here is a sample of
> each file:
> 
> 24.121.58.91     0.32
> 24.121.57.11     0100.0f66.2b81.5f
> 0.2     1     33
> 
> I was thinking of using awk, but I am not sure how to tell awk to keep
> an array for each line of 2 files (let alone 3).  Any shell script
> guru's care to lend some advice?

I'd use associative arrays in Perl or dicts in Python.  Trying to do
this in awk would be painful.

BTW, is there a way to get this out of IOS directly (assuming you're
using an IOS-based device)?



More information about the Kclug mailing list