我有一个配置文件,它可能或可能没有注释掉的任务。如果任务被评论,我想“取消评论”!
sed -i '/<!--/d; /-->/d testfile
到目前为止我有这个,但它删除了文件中的所有评论。
<!--Comment at the top of the file which should not be removed
-->
<!--
<task>
<tag>
<tag1>keep this content </tag1>
</tag>
</task>
-->
我只想删除文件中与上面类似的任务标签的注释(注释不会在同一行),但保留其间的内容。我可以使用 sed 来执行此操作而不删除任何其他评论吗?