Editing and Updating XML based on condition using Shell Script -


i want change value (i.e., value="false") using shell script. how go doing that. please provide me suggestion.

what have tried / used:

i used command-> sed 's/true/false/g' ml.xml.

problem:

but true content changed.

what like:

my requirement entails a specific content changed, not every content.

before: property name="s" value="true"

after: property name="s" value="false"

ml.file

<bean id="a"     class="com.s.analyzer.analyzer" scope="singleton">     <!--  *** change true first daily run, otherwise false *** -->     <property name="s" value="true" />      <property name="a1l" value="2.5" />     <property name="mi" value="2000" />     <property name="ma" value="1" /> </bean> 

using xml tools better here. see example how xmlstarlet:

xmlstarlet ed --ps --inplace --update '//bean/property[@name="s"]/@value' -v false ml.xml 

Comments