S/N/K-Series Search for Matching Output in 'show' commands

  • 0
  • 1
  • Article
  • Updated 4 years ago
  • (Edited)
Article ID: 14877

Products
S-Series
Matrix N-Series DFE
K-Series

Goals
Search for matching output in 'show' commands, similar to the use of the UNIX 'grep' parameter.
Use the pipe character to locate keywords in query command output.

Solution
Most 'show' commands are responsive to appending of the "|find <keyword>" sequence, which provides filtering that has the effect of only displaying output lines that include the specified keyword string.

Here are some examples:

N7(su)->show config policy |find cos 6
set policy profile 1 name QoS pvid-status enable pvid 4095 cos-status enable cos 6
set policy rule 1 iptos 104 mask 8 forward cos 6
set policy rule 1 iptos 184 mask 8 forward cos 6
N7(su)->

N7(su)->show config all |find cos 6
set policy profile 1 name QoS pvid-status enable pvid 4095 cos-status enable cos
6 tci-overwrite disable precedence 1-8,12-19,21-22,25-28,31 clear-mirror syslog
disable trap disable disable-port disable
set policy rule 1 iptos 104 mask 8 storage-type non-volatile forward cos 6 syslo
g disable trap disable disable-port disable tci-overwrite disable clear-mirror
set policy rule 1 iptos 184 mask 8 storage-type non-volatile forward cos 6 syslo
g disable trap disable disable-port disable tci-overwrite disable clear-mirror
N7(su)->

N5(su)->show system hardware |find sdram
      SDRAM:                    256 MB
      SDRAM:                    256 MB
      SDRAM:                    256 MB
N5(su)->

N7(su)->show port lacp port *.*.* status summary |find lag
fe.1.22         lag.0.1 [(32768,001188162793,32768),(32768,001f453d21aa,32768)]
fe.1.24         lag.0.1 [(32768,001188162793,32768),(32768,001f453d21aa,32768)]
N7(su)->

N7(su)->show logging buffer |find ge.1.23
<165>Dec 13 21:36:47 10.20.1.150 LinkTrap[1]Interface ge.1.23 is Up.
<165>Dec 13 21:36:49 10.20.1.150 LinkTrap[1]Interface ge.1.23 is Down.
<165>Dec 13 21:36:53 10.20.1.150 LinkTrap[1]Interface ge.1.23 is Up.
<165>Dec 17 17:55:25 10.20.1.150 LinkTrap[1]Interface ge.1.23 is Down.
<165>Dec 20 20:04:13 10.20.1.150 LinkTrap[1]Interface ge.1.23 is Up.
N7(su)->

S4(su)->show router limits |find interfaces
ip-interfaces 278 - - -
lo-interfaces 1 - - -
lpbk-interfaces 21 - - -
vlan-interfaces 256 - - -
S4(su)->

S4(su-router)->show ip ospf database |find 0.0.0.0
Displaying LS Type 1 Advertisements (Area 0.0.0.0)
Displaying LS Type 2 Advertisements (Area 0.0.0.0)
Displaying LS Type 3 Advertisements (Area 0.0.0.0)
Displaying LS Type 4 Advertisements (Area 0.0.0.0)
0.0.0.0 140.161.254.1 398 800020c2 0xa4b4
S4(su-router)->

Here are some pointers for use of this command feature:
  • It simply filters output lines not containing an exact match to the <keyword> string value. If that string value does not appear when the command is executed without "|find", then there will be no output when the command is executed with "|find".
  • None of the command menu system, including the help menus, make mention of it.
  • None of the official documentation, including manuals and release notes, make mention of it.
  • There is no list of commands that either support it or don't support it. If not supported for a particular 'show' command, then its inclusion with that command is simply ignored - no error message is generated.
  • The keyword is not case sensitive.
  • Do not add delimiters (e.g. "") to the keyword string, even if it includes spaces or special characters. Any included delimiters are assumed to be part of the keyword string value.
  • "|find" only works while CLI length is set to 0 (default). If "|find" is used while length is greater than 0 (e.g. 'set length 24'), then both of these features are ignored during the 'show' command execution. This is a known shortcoming, effectively FAD. It may be resolved in a future firmware release.
Also see this HowTo Video which explains the use of the Find and Loop parameters.
Photo of FAQ User

FAQ User, Official Rep

  • 13,620 Points 10k badge 2x thumb

Posted 4 years ago

  • 0
  • 1

There are no replies.

This conversation is no longer open for comments or replies.