Replacing words

Hi, I have am using a file that contains names that I want to replace.

Basically file 1 looks like this

jack
joe
james
john

I have another file (file 2) that looks like this

jack      2345
joe       6848
james   3342
john     3432

Basically I want to replace column1 from file1 with column 2 from file 2 if its a match. The two files are of different length. Is there a fast way of doing this?

nawk 'FNR==NR{f2[$1]=$2;next} $1=($1 in f2)?f2[$1]:$1}' file2 file1

hey i got an error

looks like this

awk: extra } at source line 1
 context is
        FNR==NR{f2[$1]=$2;next} $1=($1 in >>>  f2)?f2[$1]:$1} <<< 
awk: syntax error at source line 1
        extra }
awk: bailing out at source line 1

sorry:

nawk 'FNR==NR{f2[$1]=$2;next} $1=($1 in f2)?f2[$1]:$1' file2 file1

thank you so much! works fine