LinuxCommandLibrary

xml-edit

Edit XML documents from command line

TLDR

Update element value

$ xml edit -u "[//element]" -v "[new value]" [file.xml]
copy
Insert element
$ xml edit -s "[//parent]" -t elem -n "[child]" -v "[value]" [file.xml]
copy
Delete element
$ xml edit -d "[//element]" [file.xml]
copy
Rename element
$ xml edit -r "[//old]" -v "[new]" [file.xml]
copy

SYNOPSIS

xml edit [options] file

DESCRIPTION

xml edit modifies XML documents from command line. Part of xmlstarlet toolkit. Supports inserting, updating, deleting, and renaming elements and attributes.

PARAMETERS

-u, --update xpath

Update matching nodes.
-d, --delete xpath
Delete matching nodes.
-s, --subnode xpath
Add subnode.
-i, --insert xpath
Insert before.
-a, --append xpath
Insert after.
-r, --rename xpath
Rename nodes.
-v, --value value
Value for operation.
-t, --type type
Node type (elem, attr, text).
-n, --name name
Node name.
-L, --inplace
Edit file in place.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community