0

鉴于我有以下输出:

Loopback1 is up, line protocol is up 
  Hardware is Loopback
  Description: ** NA4-ISIS-MGMT-LOOPBACK1_MPLS **
  Internet address is 84.116.226.27/32
  MTU 1514 bytes, BW 8000000 Kbit, DLY 5000 usec, 
     reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation LOOPBACK, loopback not set
  Keepalive set (10 sec)
  Last input 12w3d, output never, output hang never
  Last clearing of "show interface" counters never
  Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
  Queueing strategy: fifo
  Output queue: 0/0 (size/max)
  5 minute input rate 0 bits/sec, 0 packets/sec
  5 minute output rate 0 bits/sec, 0 packets/sec
     0 packets input, 0 bytes, 0 no buffer
     Received 0 broadcasts (0 IP multicasts)
     0 runts, 0 giants, 0 throttles
     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
     6 packets output, 456 bytes, 0 underruns
     0 output errors, 0 collisions, 0 interface resets
     0 output buffer failures, 0 output buffers swapped out

如何匹配 "Loopback1" 而不是 "Loopback" ?换句话说,只有在接口名称旁边有一个数字时,我如何才能匹配 Tcl 中的接口名称?

4

1 回答 1

3

使用前瞻

Loopback(?=\d+)

它仅匹配 Loopback 中的 Loopback,后跟任意位数。如果要匹配环回和号码,请使用Loopback\d+

于 2012-10-14T19:33:20.610 回答