My /etc/hosts look like this:
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.13.11 idm.myhost.com
192.168.13.10 dnsf.myhost.com
192.168.13.11 idm.myhost.com
192.168.13.10 dnsf.myhost.com
192.168.13.11 idm.myhost.com
192.168.13.10 dnsf.myhost.com
192.168.13.10 temp1.myhost.com
I can query duplicated lines by query below:
print /files/etc/hosts/*/canonical["idm.myhost.com"]
or either use regex
defvar mypath /files/etc/hosts
print $mypath/*/*[.=~ regexp("dnsf.myhost.com")]
But I can't remove these matched lines with a simple rm
rm /files/etc/hosts/*/canonical["idm.myhost.com"]
The problem is, augtool just removes the canonical leaf from the node and ipaddr remains. it cause the save function to returns error. I don't want to use bash script and I try to solve the problem with augeas itself. Assist, please...
P.S. I couldn't find a complete tutorial or document for this useful tool. I would be thankful is someone can propose a good document. I've searched all the web and just found a few simple examples.