是否使用xmllint或其他解决方案修改特定节点?
我有这样一个xml文件:是否使用xmllint或其他解决方案修改特定节点?,xml,shell,aix,xmllint,xmlstarlet,Xml,Shell,Aix,Xmllint,Xmlstarlet,我有这样一个xml文件: <!-- environnement totoserver --> <envs> <env> <id>1</id> <name>toto</name> <ip_server>1.1.1.1</ip_server> <state>on</state> </env> <env> <id&g
<!-- environnement totoserver -->
<envs>
<env>
<id>1</id>
<name>toto</name>
<ip_server>1.1.1.1</ip_server>
<state>on</state>
</env>
<env>
<id>2</id> [...]
</env>
<!-- environnement tata serveur -->
<env>[...]
</env>
[...]
</envs>
1.
托托
1.1.1.1
在…上
2 [...]
[...]
[...]
为了找到特定节点的值,我使用xmllint。
有了这个,我尝试修改“toto”环境的状态值。
但是,我找不到正确的命令
那么,有人知道这样做的命令行吗
如果不可能,我怎么能做到?如果可能,不安装包装
非常感谢 使用
如果要将文件保存到位:
xmlstarlet ed --in-place -u ...
谢谢您的回答,但我的服务器中没有xmlstarlet。在软件包的现代版本中,命令的名称似乎是plain
xml
,而不是xmlstarlet
。另外,非常有用。更正我之前的评论:原始命令名始终是xml
AFAIK,但debian派生工具将其重命名为xmlstarlet
。
xmlstarlet ed --in-place -u ...