show filter tips little summary on IOS/XR

过滤语句在IOS/XR的平台上非常有用,特别是在输出大量信息的情况下。在此总结一部分常用的过滤方式:

1.RP/0/RP1/CPU0:ios#admin show controllers fabric link port s2tx | i 3/SM5/1 | i UP….DOWN
>>>用“.”替代空格

F1/SM10/SP/0/8          UP    DOWN  do      3/SM5/SP/3/27    F1/SM10/3   3/SM5/1   
F1/SM10/SP/0/9          UP    DOWN  do      3/SM5/SP/2/27    F1/SM10/3   3/SM5/1   
F1/SM10/SP/0/26         UP    DOWN  do      3/SM5/SP/1/27    F1/SM10/3   3/SM5/1   
F1/SM10/SP/0/43         UP    DOWN  do      3/SM5/SP/2/11    F1/SM10/3   3/SM5/1   
F1/SM10/SP/1/9          UP    DOWN  do      3/SM5/SP/2/0     F1/SM10/3   3/SM5/1


2.RP/0/RP1/CPU0:ios#admin show controllers fabric link port s2tx | i 3/SM5/1 | i UP DOWN
>>>XR下,根据第一个条件过滤第一次,得出的结果后又用第二个条件过滤,这样非常灵活,这是“与”的关系

F1/SM10/SP/0/8          UP    DOWN  do      3/SM5/SP/3/27    F1/SM10/3   3/SM5/1   
F1/SM10/SP/0/9          UP    DOWN  do      3/SM5/SP/2/27    F1/SM10/3   3/SM5/1   
F1/SM10/SP/0/26         UP    DOWN  do      3/SM5/SP/1/27    F1/SM10/3   3/SM5/1   
F1/SM10/SP/0/43         UP    DOWN  do      3/SM5/SP/2/11    F1/SM10/3   3/SM5/1   
F1/SM10/SP/1/9          UP    DOWN  do      3/SM5/SP/2/0     F1/SM10/3   3/SM5/1

3.RP/0/RP1/CPU0:ios#admin show controllers fabric link port s2tx | i 3/SM5/1 | i UP.*DOWN
>>>这里面”*”表示无限次,直到碰到下一个关键字DOWN

F1/SM10/SP/0/8          UP    DOWN  do      3/SM5/SP/3/27    F1/SM10/3   3/SM5/1   
F1/SM10/SP/0/9          UP    DOWN  do      3/SM5/SP/2/27    F1/SM10/3   3/SM5/1   
F1/SM10/SP/0/26         UP    DOWN  do      3/SM5/SP/1/27    F1/SM10/3   3/SM5/1   
F1/SM10/SP/0/43         UP    DOWN  do      3/SM5/SP/2/11    F1/SM10/3   3/SM5/1   
F1/SM10/SP/1/9          UP    DOWN  do      3/SM5/SP/2/0     F1/SM10/3   3/SM5/1

4.RP/0/RSP1/CPU0:A9K-2#sh interfaces | i “line|MTU|input error”
>>>通过这种方式实现跟IOS一样的需求,“或”的关系

Loopback0 is up, line protocol is up MTU 1500 bytes, BW 0 Kbit
Null0 is up, line protocol is up
MTU 1500 bytes, BW 0 Kbit
MgmtEth0/RSP0/CPU0/0 is up, line protocol is up
MTU 1514 bytes, BW 100000 Kbit (Max: 100000 Kbit)
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort

5.7609s#sh int | i line|\MTU|\Input queue
>>>在IOS上,如果想选好几个条件,用“\xxx”,“或”的关系

TenGigabitEthernet4/1 is up, line protocol is up (connected)
MTU 1500 bytes, BW 10000000 Kbit/sec, DLY 10 usec,
Input queue: 0/2000/0/0 (size/max/drops/flushes); Total output drops: 0
TenGigabitEthernet4/2 is administratively down, line protocol is down
MTU 1500 bytes, BW 10000000 Kbit/sec, DLY 10 usec,
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0

6. 对于XR的可以调用utility-更高级的过滤语句,如:

RP/0/RP1/CPU0:ios#admin show inter | utility ?               
  cut    Cut out selected fields of each line of a file
  egrep  Extended regular expression grep
  fgrep  Fixed string expression grep
  head   Show set of lines/characters from the top of a file
  less   Fixed string pattern matching
  sort   Sort, merge, or sequence-check text files
  tail   Copy the last part of files
  uniq   Report or filter out repeated lines in a file
  wc     Counting lines/words/characters of a file
  xargs  Construct argument list(s) and invoke a program

如:

#show process pidin | utility egrep -e "[0-9]+r " count
1025
本文出自 Frank's Blog

版权声明:


本文链接:show filter tips little summary on IOS/XR
版权声明:本文为原创文章,仅代表个人观点,版权归 Frank Zhao 所有,转载时请注明本文出处及文章链接
你可以留言,或者trackback 从你的网站

留言哦

blonde teen swallows load.xxx videos