Need to find a column from one file and print certain columns in second file

Hi,

I need helping in finding some of the text in one file and some columns which have same column in file 1
EG
cat file_1
aaaa
bbbb
cccc
dddd
eeee
fffff
gggg
hhhh

cat file_2
aaaa,abcd,effgh,ereref,name,age,sex,...........
bbbb,efdfh,erere,afdafds,name,age,sex...........
cccc,q134321,34324,afadf_2343,name,age,sex...........
dddd,143243,234324,afde3q4r,afrewr32r,name,324324,age,sex.............

As you can see that the file is comma "," separated and name, age,sex may not be on same colunm.

my O/P should be in the following format

aaaa,name,age,sex
bbbb,s,name,age,sex
cccc,,name,age,sex
dddd,name,age,sex

I am trying the this command nawk -F="," 'NR==FNR{a[$1]=$0;next}{print $1 $3 $11,$1 in a?a[$1];"NOT FOUND"}' file_2 file_1.
For some reason it is failing. I am running this command on a solaris machine.

Any help is greatly appreciated. Thanks in advance.

$
$
$ cat file_1
aaaa
bbbb
cccc
dddd
eeee
fffff
gggg
hhhh
$
$
$ cat file_2
aaaa,abcd,effgh,ereref,name,age,sex
bbbb,efdfh,erere,afdafds,name,age,sex
cccc,q134321,34324,afadf_2343,name,age,sex
dddd,143243,234324,afde3q4r,name,age,sex
$
$
$ perl -F, -lane 'if ($ARGV eq "file_1") {$x{$_}++} elsif (defined $x{$F[0]}){print join ",", @F[0,4..6]}' file_1 file_2
aaaa,name,age,sex
bbbb,name,age,sex
cccc,name,age,sex
dddd,name,age,sex
$
$
$

tyler_durden