2017-09-24 10 views
1

私はxmlstarletを使用して新しいです。 xmlstarletを使用してxmlノードの値を変更する方法を知りたいです。xmlstarlet xmlノードの値を置き換えます

私は何か試しました。 xmlstarlet ed --inplace -u '/ file_input/uri' 'string( "s3:// my_source")' template.xml> output.xml

は機能しません。

S3としての私の予想される出力:// my_sourceS3:// mydestinationや。私は変更したいsource_pathdestination_pathノード。あなたは、インプレースfile.xml編集オプション-Lを追加したい場合は

xmlstarlet edit \ 
      --update "//job/input/file_input/uri" \ 
      --value 's3://my_source' \ 
      --update "//job/input/file_group_settings/destination/uri" \ 
      --value 's3://mydestination' file.xml 

<?xml version="1.0" encoding="UTF-8"?> 
<job version="2.10.8"> 
    <input> 
    <deblock_enable>Auto</deblock_enable> 
    <deblock_strength>0</deblock_strength> 
    <no_psi>false</no_psi> 
    <order>1</order> 
    <timecode_source>zerobased</timecode_source> 
    <file_input> 
     <certificate_file nil="true"/> 
     <password>upass</password> 
     <uri>source_path</uri> 
     <username>uname</username> 
    </file_input> 
    <file_group_settings> 
     <rollover_interval nil="true"/> 
     <destination> 
     <password>upass</password> 
     <username>uname</username> 
     <uri>destination_path</uri> 
     </destination> 
    </file_group_settings> 
    </input> 
</job> 

はxmlstarletでは非常に多くの

答えて

1

、ありがとうございました。


参照:私はあなたに感謝し、私の心の底からのコメントを残しxmlstarlet edit --help

+0

、私がここに法律を破った場合、したくなかったいくつかの方法(方法がわからない)、I謝罪削除されます何かを迷惑メールにして、ここでしか学びません。 – RavinderSingh13

+0

こんにちはクライオス、私はあなたに前にあなたに返信しなかった私の謝罪、私は新しいラインを挿入するように頼むことを忘れた。 https://stackoverflow.com/questions/46392564/xmlstarlet-append-and-insert-new-line-value – jojo

+1

@ RavinderSingh13:ありがとうございます。あなたの前の貢献はあまりにもおしゃべりだった。 jojo:それは問題ありません。 – Cyrus

関連する問題