[augeas-devel] How can I reverse the order of the parsed keys?

Steve Shipway steve at steveshipway.org
Fri Feb 4 03:39:04 UTC 2011


What I'm trying to do is to parse an MRTG config file, which has lines in
this format:

 

Directive[targetname]: value

 

for some Directive, targetname and value.  This would be relatively easy to
parse into a format of ./Directive/targetname=value

 

However, due to the nature of the configuration file, I'd like it to appear
in the /files tree in the format

 

./targetname/Directive = value

 

I can't see a way to do this, since Augeas appears to process the file
strictly in one direction only.

 

I've thought about if the regexp positional variables were available with
some sort of pre-parsing it might work -

 

[ preparse /([a-z]+)\[(a-z)+\]/ . key $2 . [ key $1 . value ] ]

 

. but of course this doesn't work.

 

Can anyone let me know of a way to achieve this?  I can't find anything in
the documentation that seems to do what I need.

 

Thanks in advance.

 

Steve

 

 

  _____  

Steve Shipway

steve at steveshipway.org

Routers2.cgi web frontend for MRTG/RRD; NagEventLog Nagios agent for Windows
Event Log monitoring; check_vmware plugin for VMWare monitoring in Nagios
and MRTG; and other Open Source projects.

Web: http://www.steveshipway.org/software

P Please consider the environment before printing this e-mail 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20110204/52fa8c90/attachment.htm>


More information about the augeas-devel mailing list