Below sed删除{content-start}和{content-end}之间出现的所有块,但只删除第1和第3个块,而不删除第2个块。
sed -ie '/{content-start.*}/,/{content-end}/d' test.txt
test.txt:
{content-start}
abc1
def1
ghi1
{content-end}
{content-start}
abc2
def2
ghi2
{content-end}
{content-start}
abc3
def3
ghi3
{content-end}
https://stackoverflow.com/questions/50659831
复制相似问题