in reply to Re^2: Matching a cisco interface config
in thread Matching a cisco interface config
Something like this?
Outputs:#! perl -slw use strict; $/ = "!\n"; while( <DATA> ) { next unless m[^interface]; print "'$_'"; } __DATA__ interface GigabitEthernet6/10 description TRUNK-KBV-SW001 switchport trunk encapsulation dot1q switchport trunk allowed vlan 1,30,31,45,156-158 switchport mode trunk switchport nonegotiate ! stuff with more stuff ! interface GigabitEthernet6/11 description Offices switchport access vlan 31 spanning-tree portfast ! thing with other things ! interface GigabitEthernet6/12 !
C:\test>junk 'interface GigabitEthernet6/10 description TRUNK-KBV-SW001 switchport trunk encapsulation dot1q switchport trunk allowed vlan 1,30,31,45,156-158 switchport mode trunk switchport nonegotiate ! ' 'interface GigabitEthernet6/11 description Offices switchport access vlan 31 spanning-tree portfast ! ' 'interface GigabitEthernet6/12 ! '
|
|---|