To take unmatch field in first column

Im uising the below command to take the matching pattern on 1st filed

awk 'NR==FNR{_[$1];next}$4 in _' file1 file2 
file1 
12 sam kash
232 f10 kash
22 data kas
 
file2
56
789
232
 
Needed output:
12 
22

How to get the unmatching pattern

awk 'NR==FNR{A[$1];next}!($1 in A){print $1}' file2 file1
1 Like