有些show命令输出的内容太多了,不方便用户查看,则可以在show命令后面加上参数定制想要的输出信息,如例10-55所示。
例10-55  定制show命令的参数: 
Switch#show running-config | ?
beginBegin with the line that matches
exclude  Exclude lines that match
include  Include lines that match
Switch#show running-config |
在show命令后面加上“|”,然后加上相应的参数,就可以定制输出了,下面举例说明3个参数的作用(其中参数?是显示所有的可选参数),如例10-56、10-57和10-58所示。
例10-56  参数begin:
Switch#show running-config | begin interface GigabitEthernet0/1
interface GigabitEthernet0/1
!
interface GigabitEthernet0/2
!
interface Vlan1
ip address 192.168.1.8 255.255.255.0
no ip route-cache
!
ip http server
access-list 1 permit 192.168.1.1
!
line con 0
password cisco
line vty 0 4
access-class 1 in
password cisco
login
line vty 5 15
login
!
!
end
begin参数意味着输出从哪里开始,在begin后面加上interface GigabitEthernet0/1然后按下回车键,交换机输出的show run的文件不再是从头开始,而是从interface GigabitEthernet0/1处开始。
例10-57  参数exclude:
Switch#show running-config | exclude interface
Building configuration...
Current configuration : 1029 bytes
!
version 12.1
no service pad
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname Switch
!
enable secret 5 $1$sUVW$pmbgIVKXgF4cOGTpHxCuA1
enable password 3com
!
ip subnet-zero
!
ip ssh time-out 120
ip ssh authentication-retries 3
!
spanning-tree mode pvst
no spanning-tree optimize bpdu transmission
spanning-tree extend system-id
!
!
!
ip address 192.168.1.8 255.255.255.0
no ip route-cache
!
ip http server
access-list 1 permit 192.168.1.1
!
line con 0
password cisco
line vty 0 4
access-class 1 in
password cisco
login
line vty 5 15
login
!
!
end
在exclude参数后加上interface,在接下来的输出文件中,所有包含interface的输出行将不出现在配置文件中。
例10-58  参数include:
Switch#show interface | include protocol
Vlan1 is up, line protocol is up
FastEthernet0/1 is down, line protocol is down (notconnect)
FastEthernet0/2 is up, line protocol is up (connected)
FastEthernet0/3 is down, line protocol is down (notconnect)
FastEthernet0/4 is down, line protocol is down (notconnect)
FastEthernet0/5 is down, line protocol is down (notconnect)
FastEthernet0/6 is down, line protocol is down (notconnect)
FastEthernet0/7 is down, line protocol is down (notconnect)
FastEthernet0/8 is down, line protocol is down (notconnect)
FastEthernet0/9 is down, line protocol is down (notconnect)
FastEthernet0/10 is down, line protocol is down (notconnect)
FastEthernet0/11 is down, line protocol is down (notconnect)
FastEthernet0/12 is down, line protocol is down (notconnect)
GigabitEthernet0/1 is down, line protocol is down (notconnect)
GigabitEthernet0/2 is down, line protocol is down (notconnect)
Switch#
在上面的输出信息中,如果在include参数后面加上protocol,那么在接下来的输出中,所有包含protocol的行将被显示出来。