linux上如何使用sed命令替换xml中内容

我想把文件中<test>12替换为0;我使用网上的命令结果替换无效了。
sed -i "s/\<test\>12/0/g" `grep \<test\>12 -rl /opt/chen`
有人能帮我看一下吗?

[root@11~]# echo "aaa<test>12" 
aaa<test>12
[root@11 ~]# echo "aaa<test>12" | sed 's/<test>12/0/g'
aaa0

这样就可以了

温馨提示:答案为网友推荐,仅供参考
第1个回答  2014-11-20
sed -i "s/<test>12/0/g" /opt/chen
相似回答