I need to output the lines of a file where the first column’s values match the firsts column’s values of the second using awk. Easier explained with an example:
file1.txt
1
2
3
4
5
file2.txt
1 dog
4 fish
6 cat
9 rabbit
I want file3.txt to be:
1 dog
4 fish
Any help appreciated
You can try
joincommand:Or use
awk