'TextFSM multistring Value
How i can concatenate multistring data in one Value (no List) with TextFSM?
Command output (multistring data in Description)
Interface PHY Protocol Description
Eth0/0/1 up up "ID=XXX"
Eth0/0/2 down down HUAWEI, Quidway Series, Ethernet0
/0/2 Interface
Eth0/0/3 down down
Eth0/0/4 down down HUAWEI, Quidway Series, Ethernet0
/0/4 Interface
Eth0/0/5 down down "ID=YYY"
One string description template
Value INTERFACE (\S+)
Value PHY (down|\*down|up|up\(s\))
Value PROTOCOL (down|\*down|up|up\(s\))
Value DESCRIPTION (\S+.*?)
Start
^${INTERFACE}\s+${PHY}\s+${PROTOCOL}(?:\s+${DESCRIPTION})?\s*$$ -> Record
Output data
[
['Eth0/0/1', 'up', 'up', '"ID=XXX"'],
['Eth0/0/2', 'down', 'down', 'HUAWEI, Quidway Series, Ethernet0'],
['Eth0/0/3', 'down', 'down', ''],
['Eth0/0/4', 'down', 'down', 'HUAWEI, Quidway Series, Ethernet0'],
['Eth0/0/5', 'down', 'down', '"ID=YYY"']
]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|