LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   File comparison ! (https://www.linuxquestions.org/questions/linux-newbie-8/file-comparison-868633/)

noony123 03-15-2011 01:41 AM

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

druuna 03-15-2011 01:51 AM

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.

bsat 03-16-2011 04:23 AM

See if this helps

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


All times are GMT -5. The time now is 07:10 PM.