Hi,
i want to compare two files by one field say $3 in file1 needs to compare with $2 in file2.
sample file1 - reqd_charge_code
2263881188,24570896,439
2263881964,24339077,439
2263883220,22619162,228
2263884224,24631840,442
2263884246,22612161,442
sample file2 - rg_j
xyz,439,SOLO
xyz,442,SOLO
xyz,443,SOLO
xyz,444,SOLO
if file1.$3=file2.$2 then i want all the fields of file1 along with 3rd filed of file2
desired Output
2263881188,24570896,439,SOLO
i am trying this with awk script
awk -F'\t' 'NR == FNR { _[$2] = $4; next }($3) in _ { print $0 FS _[$3] > "ot"; next }{ print > "ot_no" }' rg_j reqd_charge_code
i dnt wats wrong with this ..
Please let me know if any better solution ..
Thanks