Quadruple pipe with grep operation

Syntax

<command | [case-insensitive] { include  | exclude  | begin } <regular expression> | { include  | 
exclude  | begin } <regular expression>

Description

Use the quadruple pipe with grep operation for all commands to add up to four nested '|' regular expressions to filter output based on the option and regular expression. The output of first grep operation is provided as input to the second grep operation. The output of second grep operation is provided as input to the third grep operation. And finally, the output of third grep operation is provided as input to the fourth grep operation. The final result is displayed after executing all grep operations.

Examples

The following example displays the output of the command show running-config with three pipes '|' where,

  • The first grep operation provides all occurrences of 'vlan' irrespective of its case as an input to the second grep operation.
  • The second grep operation looks for the list of 'vlan' occurrences including the string 'name' irrespective of its case from the input received from the first grep operation and provides it to the third grep operation.
  • The third grep operation looks for 'vlan' occurrences including the number '2' from the input received from second grep operation and provides the final output.
switch(config) # sh running-config | case-insensitive include vlan | include name | include 2
   name "VLAN12"
   name "VLAN20"
   name "VLAN21"
   name "VLAN22"
   name "VLAN23"
   name "VLAN24"
   name "VLAN25"
   name "VLAN26"
   name "VLAN27"
   name "VLAN28"
   name "VLAN29"