Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I have the following text in many files, standard Cisco switch stuff and I need to script something that will parse many text files and print if the command "spanning-tree guard root" is enabled on each interface. i.e. I want to search where is enabled, and return the file\interface in a print.
! interface FastEthernet1/0/3 switchport access vlan 300 switchport mode access switchport port-security maximum 130 switchport port-security switchport port-security aging time 2 switchport port-security aging type inactivity no logging event link-status speed 100 duplex full srr-queue bandwidth share 1 60 30 10 srr-queue bandwidth shape 3 0 0 0 mls qos trust device cisco-phone storm-control broadcast level pps 1k storm-control multicast level pps 2k storm-control action shutdown storm-control action trap spanning-tree portfast spanning-tree bpduguard enable spanning-tree guard root !
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: search for a string and return previous relating string if found
by tybalt89 (Monsignor) on Dec 06, 2017 at 19:56 UTC | |
|
Re: search for a string and return previous relating string if found
by NetWallah (Canon) on Dec 06, 2017 at 19:54 UTC | |
|
Re: search for a string and return previous relating string if found
by hippo (Archbishop) on Dec 06, 2017 at 17:14 UTC | |
by Anonymous Monk on Dec 06, 2017 at 18:15 UTC | |
|
Re: search for a string and return previous relating string if found
by poj (Abbot) on Dec 06, 2017 at 20:10 UTC | |
by Anonymous Monk on Dec 07, 2017 at 11:27 UTC | |
by poj (Abbot) on Dec 07, 2017 at 16:12 UTC | |
by haukex (Archbishop) on Dec 07, 2017 at 18:33 UTC |