Looking for lines, which is present in file1 but not in file2 using UNIX and awk

I have 2 files with 7 fields and i want to print the lines which is 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 am new in the field and I appreciate your help.

awk 'NR==FNR{a[$1 FS $2];next} !($1 FS $2 in a)' file2 file1

sc2/10 10 . G C 50 F=5;U=4
sc2/24 24 . T G 31 F=5;U=4
sc2/11 30 . A T 60 F=5;U=4
1 Like

For not too large files, try:

grep -v "$(cut -d" " -f1,2 file2)" file1
sc2/10 10 . G C 50 F=5;U=4
sc2/24 24 . T G 31 F=5;U=4
sc2/11 30 . A T 60 F=5;U=4
1 Like

@rdcways and RudiC: It works. Thanks.