I have file1 which looks like this:
0 0
0 1
0 8
ST1 2 3
5 2
2 2
ST3 4 3
4 2
5 5
ST5 1 9
1 5
7 8
Desired output file:
ST1 6 5 2
ST3 12 4 5
ST5 9 1 7
How to solve this? I would like to use awk. I don't know how to write the algorithm so that I can process the lines to look as in the desired output.
The idea is that I want to find the pattern (ST) and start processing from that point.
The output file scheme: ST*, column2 multiplied by column 3 on the row where we have "ST", column 1 from the rows below the "ST", but only until the next "ST" appearance.
I also don't want to process anything before the first ST*.