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

后端 未结 5 1364
轮回少年
轮回少年 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:38

    you could also use awk

    awk '/sec1/{f=1;print;next}f && !/sec2/{ $0="#"$0}/sec2/{f=0}1' file
    

提交回复
热议问题