Modifications using Lookup file

I have 2 files. File 1 delimited by ";"

File 1:

001;0;11223;xx;N;1001051;124;1;1;1001051;110;0;A_15;D;DX;U
001;0;8830943;xx;P;1226040;978;1;0;1226040;110;0;A_15;D;DX;H
001;0;10946903;xx;N;1300496;978;1;1;1300496;110;0;A_17;D;DX;H
001;0;10954168;xxt;P;1305274;978;1;0;1305274;220;0;A_13;D;DX;H

File 2:

1001051
1012427
1300496
2018181
1002418

Now for each record in File2, if found in 6th position of File 1, replace the 12th Position to "R" to look like

001;0;11223;xx;N;1001051;124;1;1;1001051;110;R;A_15;D;DX;U
001;0;8830943;xx;P;1226040;978;1;0;1226040;110;0;A_15;D;DX;H
001;0;10946903;xx;N;1300496;978;1;1;1300496;110;R;A_17;D;DX;H
001;0;10954168;xxt;P;1305274;978;1;0;1305274;220;0;A_13;D;DX;H

Thanks for the help.

awk -F';' 'NR==FNR{a[$0];next} $6 in a {$12="R"}'1 OFS=';' file2 file1
1 Like

Thanks balajesuri. Works perfectly fine. :b: