Skip to main content
Question

Reiterive parsing when the same command appears multiple times.

  • 25 June 2024
  • 2 replies
  • 43 views

Does anyone have a solution to parse multiple lines with the same constant.  For example, it is easy to create a paragraph parser to parse both the switchport trunk allowed vlan and switchport trunk allowed vlan add commands, but it will only parse one of the switchport trunk allowed vlan add instances. The “add” option can appear a number of times under one interface.

 

 

interface GigabitEthernet7/12
 switchport
 switchport trunk encapsulation dot1q
 switchport trunk allowed vlan 1,11,19,21,194,240,400,403,413,451-454,511,552
 switchport trunk allowed vlan add 660,666,667,672,711,719,725,810,820,830,832
 switchport trunk allowed vlan add 833,961,965,966

2 replies

Badge

Hi TimLang,

If you want to parse all the trunk ports with allowed vlans please use “LinesByKeyword” option

Below is the screenshot.

 

If you have different requirement, please let me know.

Thanks & Regads

Gopal

That worked, Thanks! It does insert the actual command into the output CSV. If there is a way to not do that, it would be good, but I can work around that.

Reply