I am trying to build a lens that would parse a file with the format
#header1 header2 header3
valA1 valA2 valA3
valB1 valB2 valB3
I'd the result to resemble the following tree:
root
+--[1]
| +----header1 -> valA1
| +----header2 -> valA2
| +----header3 -> valA3
+--[2]
+----header1 -> valB1
+----header2 -> valB2
+----header3 -> valB3
The problem is that first I need to parse the header line to learn the field names and remember them, and then use them multiple times as the source of key names on all following rows. Does anyone have any idea how to start writing such lens? I've checked all 181 lenses that come bundled with augeas and found no lens that I suspect would parse tables.
No, it's not possible in Augeas to store the values in the header and reuse them as labels for every line.
You can however build a tree like this one: