Script to Match first field of two Files and print

Hi,
I want to get script or command in Sun Unix which matches first fields of both the files and print the feilds of one files, example may make it more clear.

InputFile1

Alex,1,fgh
Menthos,45454,toto
Gothica,855,ee
Zenie4,77,gg
Salvatore,66,oo
Dhin,1234,papapa
Maria,2311,fcfc

InputFile2

Salvatore,pop
Alex,ofgh
Amaan,iiwer
Guulu,ee
Zenie4,gg
Menthos,era

OutputFile

Alex,1,fgh,Alex,ofgh
Menthos,,45454,toto,Menthos,era
Zenie4,77,gg,Zenie4,gg
Salvatore,66,oo,Salvatore,pop

First field of first line is searched in second file as first field, and found so both lines(FIles A and File B) are printed in output.

Thanks in advance.

Hi.

Something like:

awk -F, 'NR == FNR { A[$1] = $0; next } A[$1] { print $0 FS A[$1] } ' file2 file1

Alex,1,fgh,Alex,ofgh
Menthos,45454,toto,Menthos,era
Zenie4,77,gg,Zenie4,gg
Salvatore,66,oo,Salvatore,pop

#! /bin/ksh

sort -d -t, +0 -1 InputFile1 >> InputFile1_sort
sort -d -t, +0 -1 InputFile2 >> InputFile2_sort


join -1 1 -2 1 -t, -o 1.1 1.2 1.3 2.1 2.2 InputFile1_sort InputFile2_sort >> OutputFile
join -t',' -j 1 <(sort infile1) <(sort infile2)

Alex,1,fgh,ofgh
Menthos,45454,toto,era
Salvatore,66,oo,pop
Zenie4,77,gg,gg

The result is with only a single name column, plus it's sorted but you might prefer it that way.