Jul 8, 2009, 5:28 AM
Post #1 of 1
Hi all, I am trying to do something here that is a little beyond my current perl knowledge and need a little assistance if thats ok. Im not necessarily asking for the code, more so just a suggestion on the best method to use to achieve my goal
comparing DB output to file data
I have a database query result like below (details from the db of all network interfaces on a particular box, in this case "server1" from yesterday)
SELECT hostname,nic_name,nic_duplex,nic_ip FROM network_table WHERE hostname = "server1"
I also have a local file which has the most recent information (todays) generated from server1 itself (output formatted the same)
As you can see, a new interface "bge3" has been added/configured on server1 and the ip of bge2 has changed since yesterday
Im trying to find a way within perl of comparing the first batch of information with the second to see if anything has changed (so that i can update the database accordingly)
the change could be in either direction, i.e in the database but not in the file or in the file but not in the database
what would be the best way to compare these two sets of information, so that i can UPDATE (or INSERT/DELETE if required) the records in the database with any change that needs to be made.
Any help or advice on this would be greatly appreciated