我有以下問題:如何改變屬性值與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