LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-15-2011, 01:41 AM   #1
noony123
Member
 
Registered: Oct 2010
Posts: 167

Rep: Reputation: 0
File comparison !


Hi all.

I have following 2 files

File1
10.1.1.1
10.1.2.1
10.1.3.1

File2
10.1.3.1
10.1.2.1
10.1.1.1

Both are reverse of each other. Now, basically if you see, the contents are same, but in different order. Is there any easy way in which i can find out like which items dont match between 2 files, regardless of order. Lets say i add 10.1.4.1 to File1. Now the result of such comparison should be only '10.1.4.1'. Currently if i am comparing both files using diff, it gives me all the lines.

Kindly tell me
 
Old 03-15-2011, 01:51 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389
Hi,

Quote:
Is there any easy way in which i can find out like which items dont match between 2 files, regardless of order.
Nope, you do need to sort both files before diff (or comm) can do its thing.

BTW: I would use comm instead of diff.

Hope this helps.
 
Old 03-16-2011, 04:23 AM   #3
bsat
Member
 
Registered: Feb 2009
Posts: 347

Rep: Reputation: 72
See if this helps

http://tuxthink.blogspot.com/2011/03...s-line-by.html
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] File comparison tool noony123 Linux - Newbie 1 01-28-2011 05:39 AM
more file comparison Stannjudy Linux - Newbie 7 04-15-2008 12:08 PM
Perl - File Comparison PsypherPunk Programming 1 09-01-2006 12:58 PM
DIFF (or other file comparison) ciscokid1967 Linux - General 1 12-11-2003 02:13 PM
Good File Comparison Utility Witch-King Linux - Software 4 01-01-2003 10:13 PM


All times are GMT -5. The time now is 07:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration