Compare two fields in text files?

Hi,
I have two text files, compare column one in both the files and if it matches then the output should contain the id in column one, the number and the description.

Both the files are sorted. Is there a one liner to get this done, kindly help. Thank you

File 1:
NC_000964 92.33
NC_002570 91.07
NC_002745 97.34
NC_002758 97.40

File 2:
NC_002570 Bacillus chromosome, complete genome
NC_002745 Staphylococcus aureus complete genome
NC_002758 Staphylococcus aureus complete genome
NC_002951 Staphylococcus aureus complete genome

Output:
NC_002570 91.07 Bacillus chromosome, complete genome
NC_002745 97.34 Staphylococcus aureus complete genome

try this..

join file1 file2
1 Like

Hi pamu Thanks