I'm new using xmlstarlet, as i got to no point using bash.
I try to replace many values in an XML file at once.
What i tried was:
xmlstarlet ed -L -u "/items/item/property[@name='Stacknumber']/@value" -v '30000' items.xml
<items>
<item name="foodEggBoiled">
<property name="Stacknumber" value="50"/> <!-- This i want to change-->
</item>
<item name="foodEggRaw">
<property name="Stacknumber" value="1"/> <!-- and this not-->
</item>
</items>
The value i want to change is
<property name="Stacknumber" value="50"/>
I want to change every value from the property Stacknumber with a value above 1 to 30000 like
<property name="Stacknumber" value="30000"/>
But I don't know how to select only properties with values above 1.
item, where the query looks foritems. It would also be helpful to try to build a proper minimal reproducible example -- note the Minimal part of that specification, meaning anything unrelated to the problem shouldn't be shown (and the Complete / Verifiable specs, meaning that the code shown should be complete enough someone can see the problem -- maybe you should include two different "Stacknumber"s, one that should be changed and one that shouldn't, to be complete enough that answers can be tested).