Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Comparing Two Files

by ssandv (Hermit)
on Jun 29, 2010 at 23:15 UTC ( [id://847214]=note: print w/replies, xml ) Need Help??


in reply to Comparing Two Files

If you need them to be the same, copy the canonical one to the non-canonical one. If you need to know how they differ, and they are guaranteed to have the same order, use diff or something similar.

One way I might do it by hand if I felt I had to is to make a hash of hashes, parse the first file into it, where the host aliases were all keys and their values were say, -1, and then read the second file and add 1 to the value of %hash{hostid}{alias}. This gives you 0 if it's in both, -1 if it's in only the first file, and 1 if it's in only the second file.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://847214]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-19 14:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found