vlookup files

hi frnds

i have 2 files. 1st is dddd and 2nd is ssss

==> dddd <==:

1,charit
2,gilhotra

==> ssss <==:

1,sajan
2,doda
3,hello

and i want o/p ...mean join and vlookup both files

sajan,charit
doda,gilhotra

by using conecpt --

awk -F"," 'NR==FNR{a[$1]=$1;next} 

thnaks

No idea what a vlookup is but you can try:

$> awk -F, 'NR==FNR {a[$1]=$2; next} a[$1] {print $2,a[$1]}' OFS=, dddd ssss
sajan,charit
doda,gilhotra

Use nawk or /usr/xpg4/bin/awk on Solaris. Moving this thread to the shell scripting area - nothing Solaris specific.

-------------------------

Edit:

With join:

$> join -t, -1 1 -2 1 -o 2.2 1.2 f1 f2
sajan,charit
doda,gilhotra

thank dear....
but it gave me error

awk: syntax error near line 1
awk: bailing out near line 1

As I already wrote, did you try:

?

What about the join I posted?

You are still using no code tags when posting code, data or logs etc. Please do so - you got a PM with a guide. If that is not clear, say so, thanks.