<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE sailpoint PUBLIC 'sailpoint.dtd' 'sailpoint.dtd'>
<sailpoint>
<ImportAction name='include' value='custom/Application/CARD/CommonCardFiles/COF Imaging Applications Custom Object.xml'/>
<ImportAction name='include' value='custom/Configuration/COF - Singlenter code heree Entitlement Application Custom Object.xml'/>
<ImportAction name='include' value='custom/Rule/COF Related Application Library.xml'/>
<ImportAction name='include' value='custom/Form/COF LCM CBT Form.xml'/>
<ImportAction name='include' value='custom/Workflow/COF Identity Refresh Bypass.xml'/>
<ImportAction name='include' value='custom/Configuration/COF Unstable Roles Config.xml'/>
<ImportAction name='include' value='custom/Application/CARD/CommonCardFiles/COF Salesforce Common Correlation Rule.xml'/>
<ImportAction name='include' value='custom/Rule/COF Single SOD Violation Detection Rule.xml'/>
<ImportAction name='include' value='custom/Configuration/COF APPLICATION DEPENDENCY
</sailpoint>*
在上面提到的代码中,我试图用模式自定义/应用程序注释掉所有行
我使用的sed命令无法正常工作
sed '/<custom&Application>/s/\(.*\)/<--\1-->/' est.xml > new.xml
答案 0 :(得分:2)
应该使用XML解析器解析XML数据。
您可以使用xmlstarlet
删除这些代码xmlstarlet ed -d '//ImportAction[contains(@value,"custom/Application")]' file.xml
我不确定如何评论它们。
答案 1 :(得分:1)
这应该有效
sed -e '/custom\/Application/s/\(^.*$\)/<!--\1-->/' est.xml > new.xml
答案 2 :(得分:1)
您可以将完整的行与custom
和Applicatioin
匹配。
使用&
作为匹配的字符串。
sed 's/.*custom.*Application.*/<!--&-->/' est.xml > new.xml