Replacing lines containing a pattern with sed
Thanks to @don_crissti and @Archemar. I reckon my question is not a duplication of the above question.
So here is an example of input. Edit: All sections have values. I've added another complexity to the subheading (I should have done that).
DATA1
NAME: A (X)
12,1
13,2
14,4
NAME: B (X)
21,2
22,3
NAME: C (X)
24,4
The desired output should look like
DATA1
A 12,1
A 13,2
A 14,4
B 21,2
B 22,3
C 24,4