Forrest logo
back to the xmlstarlet tool

xmlstarlet:tldr:47832

xmlstarlet: Delete all matching nodes in place (source file is changed).
$ xmlstarlet edit --inplace --delete ${xpath} ${file-xml}
try on your machine

The command xmlstarlet edit --inplace --delete ${xpath} ${file-xml} is used to edit and delete nodes from an XML file using the XMLStarlet command line tool.

Here is a breakdown of the command:

  • xmlstarlet: This is the command line tool used for XML processing. It provides various commands for editing, querying, and transforming XML files.
  • edit: This is one of the commands provided by XMLStarlet to make edits in an XML file.
  • --inplace: This option ensures that the edits are made directly in the input XML file (in-place editing).
  • --delete ${xpath}: This option is used to specify the XPath expression that selects the nodes to be deleted from the XML file. ${xpath} is a placeholder that should be replaced with the actual XPath expression.
  • ${file-xml}: This is also a placeholder that needs to be replaced with the path of the XML file on which the edits should be applied.

Overall, the command will use XMLStarlet to edit the specified XML file by deleting all the nodes that match the provided XPath expression. The edits will be applied directly in the input XML file.

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