I'm currently writing a script to generate a report from cisco configuration for audit purposes. Using 'grep' command, I was able to successfully capture the global configurations.
But the challenge is doing it per interface. For example, I want to know which interfaces have these lines 'no ip redirects', 'no ip unreachables', etc. How can I accomplish this in bash?
Thank you in advance!
This can not be done easy with
grep
, butawk
handle this:As you see, each group is separated by
!
, so we use that to separate each record.To get only interface name do like this:
To get interface config do:
To get more patterns in one go: