Help with awk Matching columns from two files

Hello,
I have two files as following:

#bin    chrom    chromStart    chromEnd    name    score    strand    observed
585    chr2    29442    29443    rs4637157    0    +    C/T
585    chr2    33011    33012    rs13423995    0    +    A/G
585    chr2    34502    34503    rs13386087    0    +    G/T
585    chr2    36786    36787    rs11900053    0    +    C/T
585    chr2    38937    38938    rs11542478    0    +    A/C
585    chr2    47010    47011    rs6758948    0    +    C/T
585    chr2    47807    47808    rs11897072    0    +    A/G
#bin    chrom    chromStart    chromEnd    name    score    strand    observed    rsId
585    chr2    12993    12994    SNP_A-1852536    0    +    C/G    rs11127467
585    chr2    53651    53652    SNP_A-2056638    0    +    A/G    rs4438516
585    chr2    59697    59698    SNP_A-1792446    0    +    A/C    rs4499454
585    chr2    74386    74387    SNP_A-2063286    0    -    C/T    rs300770
585    chr2    86643    86644    SNP_A-2260913    0    +    A/C    rs17042545

I want to match the 5th column of the first file with 9th column of the second file and print the lines in common into a separate file.

Thank you!

Try

awk 'NR==FNR{A[$5]=$0;next}{if(A[$9]){print $0,A[$9]}}' file1 file2

What should the output look like?