我需要在文件中搜索特定字符串并删除文件中的所有行,直到我再次到达特定字符串。基本上我需要删除两个特定字符串之间的所有行。
例如
<start /myhome >
some entries
some entries
<end>
<start ~ "/myhome[^/]+" >
some entries
some entries
<end>
<start /newhome >
some entries
some entries
another entry
different string
<end>
<start ~ "/myhome[^/]+" >
some entries
some entries
<end>
预期输出应该是:
<start /myhome >
some entries
some entries
<end>
<start /newhome >
some entries
some entries
another entry
different string
<end>