<div dir="ltr">Hi Xavier,<div><br></div><div><br></div><div>The short answer is, no, this is not possible. Augeas cannot currently memorize a string is has met (except in the case of square lenses).</div><div><br></div><div>In general, Augeas' goal is not to model the meaning of the configuration file, but rather the form of it. In the same way, there is no way to interpret "include" statements, you just map them. Interpreting such things should be done in the code using Augeas (through XPath expressions), not in the lens itself.</div><div><br></div><div><br></div><div>Cheers,</div><div><br></div><div>Raphaël</div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Feb 11, 2016 at 10:16 AM, Mol, Xavier (SCC) <span dir="ltr"><<a href="mailto:xavier.mol@kit.edu" target="_blank">xavier.mol@kit.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello Augeas experts,<br>
<br>
at the end, I have pasted a broken Augeas module definition, which demonstrates what I want to achieve. Currently, the below pasted module, instead of adding subsequent members to the same group, always creates a new tree node with one child node. However, given a source text, I want to look for repetitions and bundle them together in a subtree. The problem is, that part of the repeated pattern is variable. Can I somehow memorize a matched string in Augeas and use it for pattern matching?<br>
<br>
Thank you for your time,<br>
Xavier.<br>
<br>
<br>
module Test_for_consecutive_matches =<br>
<br>
let source =<br>
"create group1<br>
create group2<br>
addto group1 memberA<br>
addto group1 memberB<br>
addto group2 memberX<br>
addto group2 memberY<br>
addto group2 memberZ<br>
"<br>
<br>
let create = [ key "create" . Sep.space . store Rx.word . Util.eol ]<br>
<br>
let addto = [ key "addto" . Sep.space . store Rx.word . Sep.space .<br>
              counter "members" . [ seq "members" . store Rx.word ] .<br>
              Util.eol<br>
            ]<br>
<br>
let lns = ( create | addto )*<br>
<br>
test lns get source =<br>
{ "create" = "group1" }<br>
{ "create" = "group2" }<br>
{ "addto" = "group1"<br>
  { "1" = "memberA" }<br>
  { "2" = "memberB" }<br>
}<br>
{ "addto" = "group2"<br>
  { "1" = "memberX" }<br>
  { "2" = "memberY" }<br>
  { "3" = "memberZ" }<br>
}<br>
<br>
<br>
<br>
****<br>
Karlsruher Institute of Technology (KIT)<br>
Steinbuch Centre for Computing (SCC)<br>
<br>
B. Sc. Xavier Mol<br>
GridKa Storage Administrator and Support Manager<br>
<br>
Hermann-von-Helmholtz-Platz 1<br>
Geb. 449<br>
76344 Eggenstein-Leopoldshafen<br>
Phone: +49 721 608 23041<br>
Email: <a href="mailto:xavier.mol@kit.edu">xavier.mol@kit.edu</a><br>
<a href="http://www.kit.edu" rel="noreferrer" target="_blank">www.kit.edu</a><br>
KIT - University of the State of Baden-Württemberg and National Large-scale Research Center of the Helmholtz Association<br>
"Since 2010, the KIT has been certified as a family-friendly university."<br>
****<br>
<br>
<br>_______________________________________________<br>
augeas-devel mailing list<br>
<a href="mailto:augeas-devel@redhat.com">augeas-devel@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/augeas-devel" rel="noreferrer" target="_blank">https://www.redhat.com/mailman/listinfo/augeas-devel</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr">Raphaël Pinson<div>Infrastructure Developer & Training Leader</div><div>+33 458 482 013<div><br></div><div>Camptocamp France<br>
Savoie Technolac<br>
BP 352<br>
48, avenue du Lac du Bourget<br>
73372 Le Bourget du Lac, Cedex<br>
<a href="http://www.camptocamp.com" target="_blank">www.camptocamp.com</a><br>
</div></div></div></div></div></div>
</div>