Last active
January 25, 2018 11:40
-
-
Save fstern/2595d0b49a19c62d52bfcb23ec411af2 to your computer and use it in GitHub Desktop.
Mapping VLAN interfaces to VRFs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
egrep -i '(^interface vlan)|(ip vrf forwarding)' showstartup-config-600.txt |\ | |
perl -e 'while (<>) { print $1,"\n" if m/^interface\sVlan(\d+)/; print $1,"\n" if m/\sip vrf forwarding (\w+)/}' |\ | |
tail -n +6 | paste - - -d, |\ | |
perl -e 'while (<>) { chomp; ($vl,$vrf) = split(/,/,$_); push @{$map->{$vrf}},$vl; } ; foreach (keys(%{$map})) { print $_, " ", join(",",@{$map->{$_}}),"\n" }; ' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment