Hi all,
I need help to add additional data from file2 to existing data in file 1 using awk, sed or perl. the ID in file 1 should match against field $3 in file2
file1
#this is a new game
ID HR_1
BASE1 30
BASE2 37
DETAIL No
TYPE L
@@
ID HR_10
BASE1 6030
BASE2 8601
DETAIL Available
TYPE L
@@
ID HR_4
BASE1 4100
BASE2 4500
DETAIL Available
TYPE F
@@
file2
Val 142-143 HR_1
Val 154-160 HR_1
Val 199-205 HR_4
Val 150-193 HR_4
Val 237-366 HR_4
Val 644-699 HR_4
Val 722-728 HR_10
Val 862-846 HR_10
Val 695-855 HR_50
The output should show like this:
#this is a new game
ID HR_1
BASE1 30
BASE2 37
DETAIL No
TYPE L
Val 142-143
Val 154-160
@@
ID HR_10
BASE1 6030
BASE2 8601
DETAIL available
TYPE L
Val 722-728
Val 862-846
@@
ID HR_4
BASE1 4100
BASE2 4500
DETAIL available
TYPE F
Val 199-205
Val 150-193
Val 237-366
Val 644-699
@@
i tried to do it with some awk codes but the output that i got totally messed up. Please help me on this. Thanks