Forrest logo
back to the xmlstarlet tool

xmlstarlet:ai:2d66f

add 1 to element's value with xmlstarlet
$ xmlstarlet ed -u '//element' -x 'text()' -n 'text() + 1' input.xml
try on your machine

This command uses xmlstarlet to update the value of an element by adding 1 to its current value in an XML file. The element should be referenced using an XPath expression ('//element' in this example).

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.

Questions that are answered by this command:

  • add 1 to element's value with xmlstarlet?
back to the xmlstarlet tool