xmlstarlet append and insert new line value

前端 未结 1 1114
余生分开走
余生分开走 2021-01-15 02:26

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.

相关标签:
1条回答
  • 2021-01-15 03:17

    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

    0 讨论(0)
提交回复
热议问题