I have a large document of blocks with a format like this:
{
foo 99 23 47
bar 1..
bar 2..
bar 3
x 55
y 97
z 88
}
I want to replace the numbers after 'foo' with the three numbers under 'bar 3'.
The numbers are in order, so no issue there.
Sometimes bar 3 does not appear in the block, if so I want the three numbers to be 0, so foo 0 0 0 in that case.
Sometimes bar 3 is listed, but perhaps only x and y are there. In that case I want the missing variable to be 0.
So:
bar 3
x 55
y 97
}
Would be: blah 55 97 0
Bar 1, 2, and other numbers have x y z values as well, not interested in them.
I feel like there should be a simple way to do this, but I couldn't find a program that had this capability.
Any ideas are greatly appreciated. If I absolutely have to write a program for it I'll try to do that. Thank you for your time.