I am trying to find occurence of captured pattern and pre-pend next line with captured pattern.
For example:
...
[line 10] #---------- SOLID: tank_phys.0
[line 11] Shape {
...
[line 22] #---------- SOLID: head_phys.0
[line 23] Shape {
...
expected output:
...
[line 10] #---------- SOLID: tank_phys.0
[line 11] DEF tank Shape {
...
[line 22] #---------- SOLID: head_phys.0
[line 23] DEF head Shape {
...
Here is what I have:
sed -rn '/#---------- SOLID: (.*)_phys.0/{n ; s/Shape/DEF <PreviousCapture> Shape/p;}' g4_00.wrl
How can I substitute Shape {
with DEF tank Shape {
?
Thanks
GT