gpt4 book ai didi

xml - 如何在shell中注释掉xml文件中的字符串

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:50:42 25 4
gpt4 key购买 nike

<?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

最佳答案

这应该可行

sed -e '/custom\/Application/s/\(^.*$\)/<!--\1-->/' est.xml > new.xml

关于xml - 如何在shell中注释掉xml文件中的字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48671491/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com