I need help working with router config backup database. I need to get a list of interfaces that don't have vrf
or shutdown
in their configuration.
I get the list of all interfaces config passing the config file through awk '/^interface/,/!/'
. This gives me the output below:
interface TenGigE0/3/0/0
description
service-policy output QOS
ipv4 mtu 1500
ipv4 address 13.24.15.3 255.255.255.252
carrier-delay up 3000 down 0
load-interval 30
dampening
!
interface TenGigE0/3/0/1
description Link To
!
interface TenGigE0/3/0/1.302
description
vrf 1671
ipv4 address 13.24.14.11 255.255.255.254
encapsulation dot1q 302
Now, i am stuck trying to exclude the interfaces that contain vrf
line. What i was trying to do is to grep for vrf, and when there is a match, remove the line that contains the word "interface" above. Unfortunately with no luck. Maybe someone has a more sophisticated solution.