我有一个xml文件,我想根据文本文件中的值更改节点值。 所以基本上这是xml文件 - > 001.xml
<?xml version="1.0" encoding="UTF-8"?>
<Orderfile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<order>
<establishmenthour>10:38:00</ establishmenthour>
<ExpirationDate/>
<acc/>
<identification>170610009-01</identification>
</order>
<order>
<establishmenthour>10:40:00</ establishmenthour>
<ExpirationDate/>
<acc/>
<identification>170610910-03</identification>
</order>
<order>
<establishmenthour>10:42:00</ establishmenthour>
<ExpirationDate/>
<acc/>
<identification>170610015-01</identification>
</order>
这是我的文本文件
170610009-01;2017-06-21
170610015-01;2017-02-22
我想拥有什么
<?xml version="1.0" encoding="UTF-8"?>
<Orderfile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<order>
<establishmenthour>10:38:00</establishmenthour>
<ExpirationDate>2017-06-21</ExpirationDate/>
<acc/>
<identification>170610009-01</identification>
</order>
<order>
<establishmenthour>10:40:00</ establishmenthour>
<ExpirationDate/>
<acc/>
<identification>170610910-03</identification>
</order>
<order>
<establishmenthour>10:42:00</ establishmenthour>
<ExpirationDate>2017-02-22</ExpirationDate/>
<acc/>
<identification>170610015-01</identification>
</order>
我决定使用xmlstarlet编写一个bash脚本,但它似乎不起作用
#!/bin/bash
while read line; do
last10=${line:14:23}
first12=${line:0:12}
if /orderFile/order[identification = '${first12}']
then xmlstarlet ed -u /orderFile/order[@expirationDate]/@expirationDate -v "${last10}" 001.xml
fi
done < datevalid.txt
我哪里错了?