Using AWK how can I change the property enabled="true" to enabled="false" . I need to do this for all occurrences in the ResultCollector only.
使用AWK如何将属性enabled =“true”更改为enabled =“false”。我需要仅对ResultCollector中的所有事件执行此操作。
Before:
之前:
<asdjasl enabled="true">
<ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="true">
<ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="true">
<asdjasl enabled="true">
After:
后:
<asdjasl enabled="true">
<ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="false">
<ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="false">
<asdjasl enabled="true">
1 个解决方案
#1
2
The best way to change an XML property is with an XML processing tool, not a text processing tool. I'd use xmlstarlet
更改XML属性的最佳方法是使用XML处理工具,而不是文本处理工具。我用的是xmlstarlet
xmlstarlet ed --inplace --update '//ResultCollector/@enabled' --value 'false' file.xml
#1
2
The best way to change an XML property is with an XML processing tool, not a text processing tool. I'd use xmlstarlet
更改XML属性的最佳方法是使用XML处理工具,而不是文本处理工具。我用的是xmlstarlet
xmlstarlet ed --inplace --update '//ResultCollector/@enabled' --value 'false' file.xml