In the File Test1.jmx I need to replace a string value to be false where the value = true or 0 or null. I need to do this for all occurrences of the string in the file.
before:
<boolProp name="ThreadGroup.scheduler">true</boolProp>
after:
<boolProp name="ThreadGroup.scheduler">false</boolProp>
Here's my erroneous code:
overrides_scheduler="BLAAA FOO MOO"
overRides=$(awk -v newValue="$overrides_scheduler" '$0 ~ /boolProp name="ThreadGroup.scheduler"/ {a=$0; sub(/<boolProp name="ThreadGroup.scheduler">[a-zA-Z0-9]/,"<boolProp name=\"ThreadGroup.scheduler\">"newValue,a); print a; next;}{}1' "Test1.jmx");
echo  "$overRides" > "Test1.jmx"
Test1.jmx:
<boolProp name="ThreadGroup.scheduler">true</boolProp>
<longProp name="ThreadGroup.end_time">1363247040000</longProp>
<longProp name="ThreadGroup.end_time">1363247040000</longProp>
<boolProp name="ThreadGroup.scheduler">true</boolProp>
<longProp name="ThreadGroup.end_time">1363247040000</longProp>
<boolProp name="ThreadGroup.scheduler">true</boolProp>
<boolProp name="ThreadGroup.scheduler"></boolProp>
<longProp name="ThreadGroup.end_time">1363247040000</longProp>
<boolProp name="ThreadGroup.scheduler">0</boolProp>
