I'm new to textFSM. Trying to use the same value to find and save multiple instances of a value matches across multiple lines of input text. I have tried a number of different constructs but none provides the desired output.
Input
set=
1. text1 2. text2 3. text3
4. text4 5. text5
6. text6
Template file:
Value List alm (\S+)
Start
^\s*\d+.\s+${alm} -> Continue.Record
Actual Result: [text1, text4, text6]
Desired Result: [text1, text2, text3, text4, text5, text6]
Any pointers on how to achieve the desired results?
If you know the maximum number of entries per line, then you can add a separate regex for each entry. Note that you should not use
Recordas that finishes the list and starts a new row in the result table.Template, adapted from https://github.com/google/textfsm/issues/11#issuecomment-273649451:
Python code:
Result:
Of course this is not very general. There are proposals to build repeated matches per line into TextFSM, but these are not implemented yet. More information: Issue 11, Issue 18, Issue 69.