I have an xml file that look something like this
<Process label="TRAM_FIT_TM_SERVER" machine="&HOSTNAME_TRAM;">
<Description>Monitor that TM SERVER stays up</Description>
<Enabled>true</Enabled>
<ProcessCheck method="ps">
<ProcName>.*bin/tmSrv -serverMode=tm</ProcName>
</ProcessCheck>
<Cmd>cd /ctec/apps/fotms/6.2/scripts/; ./tradeFlow.sh fitdev start tm > &LOGLOC;/fotms/logs/starttm.log</Cmd>
<KillCmd>pkill -u &USER; -f 'bin/tmSrv -serverMode=tm'</KillCmd>
<Count>1</Count>
<User>&USER;</User>
&EMAIL_SUPPORT;
&TRAM_SCHEDULE;
</Process>
There are about 40 odd of the processes, all with the same exact layout. I am able to read through the file in a while loop, stop at this specific Process using its Process label. Then I am able to grab the Enabled line, which is what I need to change like so.
while read line
do
if [[ "$line" == *"TRAM_FIT_TM_SERVER"* ]]
then
echo ...
var_checker=2
fi
if [[ "$line" == *"Enabled"* ]]
then
if [ "$var_checker" == 2 ]
then
#change value to false
#sed -i 's/true/false/g' $line
var_checker=1
echo "Changed trade server"
break 3
fi
fi
done <fit.core_tram.procmon.xml
My question is, how do I change the Enabled value of this process, and ONLY for this process to false. I need to use sed or grep if possible, and I unfortunately can't just do sed -i 's/true/false/g' filename due to the fact there being multiple occurrences of that exact setup. Any help would be appreciated