我有以下问题:如何改变属性值与augeas在XML中的位置变化?
我的XML(简体):
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<properties>
<property name="username">USERNAME</property>
<property name="anything">blabla</property>
</properties>
</configuration>
我需要更换与augeas Username值。 它工作正常:
augtool> set /files/test.xml/configuration/properties/property[1]/#text NEWUSER
但问题是:用户名条目不总是在一个位置。 augeas有没有办法用“匹配”或某种正则表达式来寻找位置?
augtool> match /files/test.xml/configuration/properties/*/#attribute/name username
工作正常的结果
/files/test.xml/configuration/properties/property[1]/#attribute/name
但我不知道如何设置值时使用此信息。
默认情况下,augeas只能查看/ etc /和/ boot中的文件,您是否创建了自定义镜头? – spuder