Displaying difference of 2 files

Hi All,

Got this 2 file namely a.txt and b.txt, i want to know how to extract the difference between the two files, the output will be written to a file.

e.g.
>>a.txt<<

Nokia 1100
Nokia 1200
Nokia 1300
Nokia 1400
Nokia 1500
Nokia 1600
Nokia 1700
Nokia 1701
Nokia 1702
Sagem 1100
Nokia 1201

>>b.txt \<<

Nokia 1100
Sagem 1100
Nokia 1700
Nokia 1200
Nokia 1300
Nokia 1400
Nokia 1500
Nokia 1201
Nokia 1202
Nokia 1203
Nokia 1701
sort a.txt > a1.txt
sort b.txt > b1.txt

diff a1.txt b1.txt
1 Like

Hi,

Thanks.

So i need to sort it first, so that i have accurate result. I will test it later. :b:

u dnt need to sort, the diff command will run without that also.

 diff file 1 file 2

it will show the diffrence between 2 files on ur machine..

diff file 1 file 2 >> out.file

nw the difference will be stored in out.file.