我试图找到捕获模式的出现并在下一行之前添加捕获的模式。
例如:
...
[line 10] #---------- SOLID: tank_phys.0
[line 11] Shape {
...
[line 22] #---------- SOLID: head_phys.0
[line 23] Shape {
...
预期输出:
...
[line 10] #---------- SOLID: tank_phys.0
[line 11] DEF tank Shape {
...
[line 22] #---------- SOLID: head_phys.0
[line 23] DEF head Shape {
...
这是我所拥有的:
sed -rn '/#---------- SOLID: (.*)_phys.0/{n ; s/Shape/DEF <PreviousCapture> Shape/p;}' g4_00.wrl
我该如何Shape {替换DEF tank Shape {?
谢谢
燃气轮机