小编pri*_*nka的帖子

使用 xmlstarlet 替换 XML 中的标记值

我试图testlookupinput.xml替换该值。脚本正在执行,没有任何错误,但它没有替换该值。

sed -i '/<Filter>/,/<\/Filter>/s/test/lookup/' input.xml > input_1.xml
Run Code Online (Sandbox Code Playgroud)

下面是我的 input.xml 文件:

<NikuDataBus
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="./src/webroot/WEB-INF/xog/xsd/nikuxog_entity.xsd">
    <Header version="14.2" action="read" objectType="contentPack" externalSource="NIKU"/>
    <LookupQuery>
        <Filter name="code" criteria="EQUALS">test</Filter>
    </LookupQuery>
</NikuDataBus>
Run Code Online (Sandbox Code Playgroud)

xml shell sed xmlstarlet

2
推荐指数
1
解决办法
1265
查看次数

标签 统计

sed ×1

shell ×1

xml ×1

xmlstarlet ×1