使用 XMLStarlet 的 bash 脚本中引号之间的 space 个字符
space character between quotes in bash script using XMLStarlet
我正在尝试使用工具 XMLStarlet 在 bash 中使用脚本编辑我的 xml 文件。
所以我想删除我文件的一个完整标签,我的问题是我的命令语法如下:
xmlstarlet ed -d "/properties/structure name=\"preference\"" $1
标签是<结构名="preference">
我的错误是:
XPath 错误:无效的表达式
/properties/structure" "名字="preference"
错误指向第一个引号 (")
我尝试插入引号和反斜杠以使 space 字符可以接受,但我找不到使其工作的方法。
有人可以帮我解决这个问题吗?我还没有找到谈论这个的话题。
提前致谢
发件人:
<properties>
<bla name="preference" >
</bla>
<structure name="preference" >
</structure>
<structure name="xxx" >
</structure>
</properties>
那个:
xmlstarlet ed -d '/properties/structure[@name="preference"]'
生产
<?xml version="1.0"?>
<properties>
<bla name="preference">
</bla>
<structure name="xxx">
</structure>
</properties>
我正在尝试使用工具 XMLStarlet 在 bash 中使用脚本编辑我的 xml 文件。 所以我想删除我文件的一个完整标签,我的问题是我的命令语法如下:
xmlstarlet ed -d "/properties/structure name=\"preference\"" $1
标签是<结构名="preference">
我的错误是: XPath 错误:无效的表达式 /properties/structure" "名字="preference" 错误指向第一个引号 (")
我尝试插入引号和反斜杠以使 space 字符可以接受,但我找不到使其工作的方法。 有人可以帮我解决这个问题吗?我还没有找到谈论这个的话题。
提前致谢
发件人:
<properties>
<bla name="preference" >
</bla>
<structure name="preference" >
</structure>
<structure name="xxx" >
</structure>
</properties>
那个:
xmlstarlet ed -d '/properties/structure[@name="preference"]'
生产
<?xml version="1.0"?>
<properties>
<bla name="preference">
</bla>
<structure name="xxx">
</structure>
</properties>