Reputation: 405
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.
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">
Upvotes: 0
Views: 91
Reputation: 247012
The best way to change an XML property is with an XML processing tool, not a text processing tool. I'd use xmlstarlet
xmlstarlet ed --inplace --update '//ResultCollector/@enabled' --value 'false' file.xml
Upvotes: 2