Hi,
I need help on replacing values in certain field in my file1.txt based on matched patterns in file2.txt using awk.
The blue color need to match with one of the data in field $2 in file2.txt. If match, BEGIN and FINISHED value in red will have a new value from field $3 and $4 accordingly.
file1.txt
ID N_4736
NAME N_4736
BEGIN 544
FINISHED 550
COM Safe
ID N_32
NAME N_32
BEGIN 872
FINISHED 1027
COM Crash
Input file2.txt
test1 4754 120 160
test1 4736 500 600
test1 5487 1478 200
test1 32 800 1000
The output should look like this:-
D N_4736
NAME N_4736
BEGIN 500
FINISHED 600
COM Safe
ID N_32
NAME N_32
BEGIN 800
FINISHED 1000
COM Crash
i tried couple of codes that i found and do necessary modification but it's either gave me nothing or just display the same data again. I really don't know how to do this. :wall: appreciate your kind help on this. thanks