prints:perl -nE "m/^interface (\S+)/ and $int=$1; m/ spanning-tree guard root +/ and print qq|$int $_|" YOUR-FILE.txt
Somewhat simple-minded, but should do the trick.FastEthernet1/0/3 spanning-tree guard root
All power corrupts, but we need electricity.
In reply to Re: search for a string and return previous relating string if found
by NetWallah
in thread search for a string and return previous relating string if found
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |