I have two files:
file1
:
905894
1197693
3703749
file2
:
905894 Test1
1197693 Test2
3703749 Test3
I want to get the values in the second column if elements in file 1 column 1 matches any of the words in file 2 column 1.
I know awk can do it, but stuck in reading file 1 and using a loop.
join -o 2.2 <(sort file1) <(sort file2)
orawk 'NR==FNR{a[$1]; next} ($1 in a) {print $2}' file1 file2
– don_crissti Apr 30 '15 at 22:33