match two key columns in two files and print output (awk)

I have two files... file1 and file2.
Where columns 1 and 2 of file1 match columns 1 and 2 of file2 I want to create a new file that is all file1 + columns 3 and 4 of file2

:b: Many thanks if you know how to do this.... :b:

file1
31-101 106 0 92
31-101 106 29 92
31-101 106 85 12
31-101 106 66 11
31-101 106 71 33
31-101 146 0 14
31-101 146 45 14
31-101 146 94 14
31-101 146 86 15
31-101 146 93 15
31-101 146 72 15
31-101 186 10 14
31-101 186 58 14
31-101 186 48 14
31-101 186 39 15
31-101 186 54 15
31-101 186 68 15
31-102 106 0 144
31-102 106 128 194
31-102 106 167 198
31-102 106 244 106
31-102 106 240 132
31-102 106 255 139
31-102 106 294 262

file2
31-101 106 396333 9256246
31-101 146 396764 9256784
31-101 186 396676 9256357
31-102 106 397346 9256457

Desired output
All of file one columns 3 and 4 of file two
31-101 106 0 92 396333 9256246
31-101 106 29 92 396333 9256246
31-101 106 85 12 396333 9256246
31-101 106 66 11 396333 9256246
31-101 106 71 33 396333 9256246
31-101 146 0 14 396764 9256784
31-101 146 45 14 396764 9256784
31-101 146 94 14 396764 9256784
31-101 146 86 15 396764 9256784
31-101 146 93 15 396764 9256784
31-101 146 72 15 396764 9256784
31-101 186 10 14 396676 9256357
31-101 186 58 14 396676 9256357
31-101 186 48 14 396676 9256357
31-101 186 39 15 396676 9256357
31-101 186 54 15 396676 9256357
31-101 186 68 15 396676 9256357
31-102 106 0 144 397346 9256457
31-102 106 128 194 397346 9256457
31-102 106 167 198 397346 9256457
31-102 106 244 106 397346 9256457
31-102 106 240 132 397346 9256457
31-102 106 255 139 397346 9256457
31-102 106 294 262 397346 9256457

awk 'FNR==NR{a[$1,$2]=$3 FS $4;next}{print $0,a[$1,$2]}' file2 file1
1 Like

I spent all morning on that and you resolved it within 3 minutes... thanks!