SyntaxFix
Write A Post
Hire A Developer
Questions
Easiest way to do is :
awk 'NR==FNR{a[$1]++;next} a[$1] ' file1 file2
Files are not necessary to be sorted.