By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,541 Members | 1,476 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,541 IT Pros & Developers. It's quick & easy.

Compare two files and print difference

P: 1
Hello Experts

I have two files file1 and file2, both have IP addresses.
Basically i want a comparison in which i can get any new IPs present in file2 when compared it with file1 and viceversa.

(up to 650 plus IP's)


have lot of IPs same as file but some new IP's too which may not present in file1.

So how to compare both files using perl or any other unix script.

I'm a newbie as far as scripting is considered, Please help.

Siva Murugan
Aug 14 '10 #1
Share this Question
Share on Google+
1 Reply

P: 70
Since you are on unix, you can use sort and comm. comm will show you which IPs are present in both files and which are unique to both files.
Aug 14 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.