#! 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
!
Outputs: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
!
'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
|