Match file and extract the output

Hi All

I have 2 file . I need match the files based on key and then form a third file which have the matching values

FILE1:
10264;K*AD
10265;K*AIR 
10266;K*AUTO
10267;K*BABY 
10268;K* FOOD

FILE2:
10264;1055.83
10265;716.94
10267;331.80
10268;23283.33

OUTPUT (Needed)
10264;K*AD;1055.83
10265;K*AIR;716.94
10266;K*AUTO;NA
10267;K*BABY;331.80
10268;K* FOOD;23283.33

Thanks in advance

Try

join -t";" -a1 -a2 -eNA -oauto file[12]
1 Like

Hello arunkumar_mca,

Could you please try following too.

awk 'BEGIN{FS=OFS=";"} FNR==NR{a[$1]=$2;next} ($1 in a){print $0,a[$1]}'  Input_file2   Input_file1

Thanks,
R. Singh

Moderator comments were removed during original forum migration.