Forrest logo
back to the xmlstarlet tool

xmlstarlet:tldr:9f8c5

xmlstarlet: Update the value of all matching nodes in place (source file is changed).
$ xmlstarlet edit --inplace --update ${xpath} --value ${new_value} ${file-xml}
try on your machine

This command is using the xmlstarlet tool to edit an XML file. Here is the explanation of each part of the command:

  • edit: This is the xmlstarlet subcommand that allows you to perform XML editing operations.

  • --inplace: This option tells xmlstarlet to edit the XML file in-place, meaning that the changes will be made directly in the file.

  • --update ${xpath}: This option specifies the XPath expression to locate the elements/attributes in the XML file that you want to update. ${xpath} should be replaced with the actual XPath expression.

  • --value ${new_value}: This option sets the new value for the elements/attributes specified by the XPath expression. ${new_value} should be replaced with the actual new value.

  • ${file-xml}: This is the input XML file that you want to edit. ${file-xml} should be replaced with the actual file path.

So, when you execute this command, xmlstarlet will update the XML file specified by ${file-xml} by locating the elements/attributes using the XPath expression ${xpath}, and then setting their values to ${new_value}.

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.
back to the xmlstarlet tool