Wednesday, 21 August 2013

Looking for lines which is in one file but not in other using Unix and Awk

Looking for lines which is in one file but not in other using Unix and Awk

I have 2 files with 7 fields and I want to print the lines which are
present in file1 but not in file2 based on field1 and field2.
Logic: I want to print all the lines, where there is a particular column1
and column2. And we do not find the set of column1 and column2 in file2.
Example: "sc2/10 10" this set you would not see in file 2, therefore it is
printed as output.
File1:
sc2/80 20 . A T 86 F=5;U=4
sc2/60 55 . G T 76 F=5;U=4
sc2/10 10 . G C 50 F=5;U=4
sc2/68 20 . T C 71 F=5;U=4
sc2/24 24 . T G 31 F=5;U=4
sc2/11 30 . A T 60 F=5;U=4
File2:
sc2/80 20 . A T 30 F=5;U=4
sc2/60 55 . T T 77 F=5;U=4
sc2/68 20 . C C 01 F=5;U=4
sc2/24 29 . T G 31 F=5;U=4
sc2/24 19 . G G 11 F=5;U=4
sc2/88 89 . T G 51 F=5;U=4
Expected Output:
sc2/10 10 . G C 50 F=5;U=4
sc2/11 30 . A T 60 F=5;U=4
I would appreciate your help.

No comments:

Post a Comment