Skip the “show ip route” legend
Are you as upset as I am with the constant display of the legend in front of the routes displayed with the show ip route command? Two output filters can help you.
The easier one is show ip route parameters ¦ begin Gateway (as there is always a line starting with Gateway of last resort ...) before the actual IP routes:
a1#show ip route 172.16.0.0 longer ¦ begin GatewayA slightly more complex one matches the first line that has a digit after the leading white space.
Gateway of last resort is not set
172.16.0.0 255.255.0.0 is variably subnetted, 4 subnets, 2 masks
O 172.16.0.21 255.255.255.255
[110/51] via 172.18.1.2, 00:04:56, Serial0/0/0.100
O 172.16.0.12 255.255.255.255
[110/65] via 172.18.1.6, 00:04:56, Serial0/1/0
C 172.16.0.11 255.255.255.255 is directly connected, Loopback0
O 172.16.1.4 255.255.255.252
[110/113] via 172.18.1.6, 00:04:56, Serial0/1/0
a1#show ip route 172.16.0.0 longer ¦ begin ^ +[0-9]+
172.16.0.0 255.255.0.0 is variably subnetted, 4 subnets, 2 masks
O 172.16.0.21 255.255.255.255
[110/51] via 172.18.1.2, 00:08:55, Serial0/0/0.100
O 172.16.0.12 255.255.255.255
[110/65] via 172.18.1.6, 00:08:55, Serial0/1/0
C 172.16.0.11 255.255.255.255 is directly connected, Loopback0
O 172.16.1.4 255.255.255.252
[110/113] via 172.18.1.6, 00:08:55, Serial0/1/0
If only IOS would have more decent regular expressions, like \s and \d ...
PE12#show ip route | ex -
Gateway of last resort is 0.0.0.0 to network 0.0.0.0
C 192.168.12.0/24 is directly connected, FastEthernet0/1
5.0.0.0/24 is subnetted, 1 subnets
C 5.2.2.0 is directly connected, Loopback0
7.0.0.0/24 is subnetted, 1 subnets
C 7.0.0.0 is directly connected, FastEthernet0/0
S* 0.0.0.0/0 is directly connected, FastEthernet0/0
Great blog BTW.
#sh ip route | s net
Gateway of last resort is 10.48.77.1 to network 0.0.0.0
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 1.1.1.1/32 is directly connected, Virtual-Access1.1
C 1.1.1.0/24 is directly connected, Virtual-Access1.1
2.0.0.0/32 is subnetted, 1 subnets
C 2.2.2.2 is directly connected, Loopback0
210.23.147.0/30 is subnetted, 1 subnets
C 210.23.147.236 is directly connected, ATM1/0.1600042
10.0.0.0/24 is subnetted, 1 subnets
C 10.48.77.0 is directly connected, GigabitEthernet0/2
BTW, your filter does not include non-subnetted major networks, like
O 192.168.0.0 255.255.255.0
[110/51] via 172.16.1.2, 00:03:40, Serial0/0/0.100
[110/51] via 10.0.0.6, 00:03:40, FastEthernet0/0
Here's the official documentation about the section keyword:
Show Command Section Filter
It's not very detailed but at least, I've found that we can do | section exclude regexp. For example, sh run | s e ^int|!" might be useful when you have a lot of interfaces.