我正在编写一个脚本来从cisco设备捕获某些配置行。不幸的是缓冲区不断填满。所以我想知道cisco设备是否可以有2个包含语句。 例如:
show start | include vpn && protocol
我需要信息的两行没有任何共同之处。我想避免使用2个命令。有没有办法可以用一个命令获得两行?
另一个与cisco-show相关的问题是,如果我可以将输出限制为前10行,有些事情如下:
show start | inc first 10
答案 0 :(得分:2)
此示例显示逻辑“OR”
R1#show ip int br
Interface IP-Address OK? Method Status Protocol
Ethernet0/0 unassigned YES TFTP administratively down down
Ethernet0/1 192.168.56.11 YES TFTP up up
Ethernet0/2 unassigned YES TFTP administratively down down
Ethernet0/3 unassigned YES TFTP administratively down down
R1#
R1#show ip int br | inc Ethernet0/0|192.168.56.11
Ethernet0/0 unassigned YES TFTP administratively down down
Ethernet0/1 192.168.56.11 YES TFTP up up
R1#
另一个例子使用正则表达式来使用逻辑“AND”:
R1#show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
a - application route
+ - replicated route, % - next hop override
Gateway of last resort is not set
192.168.56.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.56.0/24 is directly connected, Ethernet0/1
L 192.168.56.11/32 is directly connected, Ethernet0/1
R1#
R1#
R1#show ip route | inc C.*directly connected
C 192.168.56.0/24 is directly connected, Ethernet0/1
R1#
希望这有帮助
答案 1 :(得分:-1)
对于问题的第二部分,我能想到的唯一方法是将终端长度设置为10行。
DeskSwitch#terminal length?
< 0-512>屏幕上的行数(0表示不暂停)
DeskSwitch#terminal length 10
DeskSwitch #sh run
构建配置......
当前配置:12735字节
<!/ P>
!最后一次配置更改于CDT 14:28:02 2018年5月3日由jerky
! NVRAM配置最后更新于CDT Fri Apr 27 2018年23:59:25
<!/ P>
版本15.2
没有服务垫
service tcp-keepalives-in
- 更多 -