excluding first and last lines from sed /START/,/END/

后端 未结 5 1366
轮回少年
轮回少年 2020-12-24 01:18

Consider the input:

=sec1=
some-line
some-other-line

foo
bar=baz

=sec2=
c=baz

If I wish to process only =sec1= I can for example comment

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-24 01:39

    I've used:

    sed '/begin/,/end/{/begin\|end/!p}'
    

    This will search all the lines between the patterns, then print everything not containing the patterns

提交回复
热议问题