sed 搜索并替换 html 标签

达斯·维达

我正在尝试搜索并替换以下特定标签:

<@include_page path='/FooServlet' params={'itemType': 'component', 'id': '92', 'componentURI': 'foo:92-20975', 'templateURI': 'ttt:92-1082-32','lazyLoad':'enabled' }/>

I want to replace it with 

<#-- <@include_page path='/FooServlet' params={'itemType': 'component', 'id': '92', 'componentURI': 'foo:92-20975', 'templateURI': 'ttt:92-1082-32','lazyLoad':'enabled' }/> -->

我能够删除该行 find . -type f -exec sed -i '/20975/d' {} \;

但是,我需要将包含的行注释掉 20975

同样,我需要在之后删除注释。

任何帮助表示赞赏。

埃德·莫顿
sed 's/.*20975.*/<#-- & -->/' file

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章