I\'d like to know how to add a new line using xmlstarlet.
My aim is to add a after job/input/file_input/uri.
I suggest to append (--append
) after the desired node/element a new element (--type elem
) with name audio (--name "audio"
) and value (--value "track_01"
):
xmlstarlet edit \
--update "//job/input/file_input/uri" \
--value 's3://my_source' \
--update "//job/input/file_group_settings/destination/uri" \
--value 's3://mydestination' \
--append "//job/input/file_input/uri" \
--type elem --name "audio" --value "track_01" file.xml
If you want to edit file.xml inplace, add option -L
.
See: xmlstarlet edit --help