I'm searching for a way to solve this problem in
X 1 Y 2 Z 3 X 4 Y 5
The output should look like this:
X 5 Y 7 Z 3
I see two problems here: the first one is the indirect reference in
awk. Is it even possible?
It would work this way: if
$$1 (X) exists add $2 else declare $$1 (X) then add $2
Even if I would figure out how to do it I would still need to know the name of all the declared variables i.e. X,Y,Z.
I'm guessing there is a simpler way to handle this task but I can't figure it out...