On 24 Nov 2012, at 9:19 AM, Raphaël Pinson <raph...@gmail.com> wrote:
> I can add a particular value to a given array with the set command, for > example like this: > > augtool> set /files/etc/postfix/main.cf/virtual_alias_maps[last()] my-map > > > This will set the last element, even if it already exists. If you want to add > an element to the array, you should use: > > set /files/etc/postfix/main.cf/virtual_alias_maps[last()+1] my-map > > Note that this operation is not idempotent, it will add a new entry every > time you run it. Sorry you're right - that was a typo. > > I am struggling with the syntax to remove this value "my-map" again: > > augtool> rm [what-goes-here?] > > > If you want to remove all virtual_alias_maps values, simply use: > > rm /files/etc/postfix/main.cf/virtual_alias_maps > > If you only want to remove the last value: > > rm /files/etc/postfix/main.cf/virtual_alias_maps[last()] I don't want to remove the last value, I want to remove a specific value "my-map", which may appear anywhere in the array (the removal in my case will take place way after the addition, and other additions may have been made in the mean time). Is there a way to reference the index of the array that contains that specific value, like this? rm /files/etc/postfix/main.cf/virtual_alias_maps[(index-of-the-value-my-map)] Regards, Graham --
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ augeas-devel mailing list augeas-devel@redhat.com https://www.redhat.com/mailman/listinfo/augeas-devel