xmlstarlet replace value after pattern

后端 未结 2 452
忘掉有多难
忘掉有多难 2021-01-28 08:07

I have a pom.xml, that I want to change the properties values for tags that starting in a certain pattern.

I usually use xmlstarlet to manipulate XML bu

2条回答
  •  无人及你
    2021-01-28 08:59

    What you are interested in is the Xpath function starts-with. It is a standard function since Xpath 1.0. This allows you to do :

    $ xmlstarlet ed -N N="http://maven.apache.org/POM/4.0.0"        \
                    -u "//N:*[starts-with(name(),'company.mgrid')]" \
                    -v "0.9-SNAPSHOT" pom.xml
    

提交回复
热议问题