sed: Find pattern over two lines, not replace after that pattern

前端 未结 3 1521
Happy的楠姐
Happy的楠姐 2021-01-21 09:22

Wow, this one has really got me. Gonna need some tricky sed skill here I think. Here is the output value of command text I\'m trying to replace:

...
fast
              


        
3条回答
  •  余生分开走
    2021-01-21 10:01

    This might work for you:

    sed '$!N;s/^fast\n\s*n :/Noun\n :/;P;D' file
    ...
    Noun
     : abstaining from food
    

提交回复
热议问题