FILTERING OUTPUT
The output from commands can in most cases be filtered to limit the output to only those lines that
match/trigger a specific string. The available filtering is:
Begin – display the first line that begins with the matching string and all subsequent lines
Include – display only those lines that match
Exclude – display only those lines that do not match
The filter is added at the end of the command and its parameters; the | character marks the beginning of
the filter. The <string> parameter is case-sensitive and can specify any item in the output line. The
syntax is:
<command> | { begin | include | exclude } <string>
! Execute a command that generates some output; no filtering initially:
SWI2210-XXXX# show users
Line is con 0.
* You are at this line now.
Connection is from Console.
User name is admin.
Privilege is 15.
Elapsed time is 0 day 21 hour 52 min 50 sec.
Idle time is 0 day 0 hour 0 min 0 sec.
! Filter to include specific word:
SWI2210-XXXX# show users | include User
User name is admin.
! Exclude all lines that contain ‘0’ (zero)
SWI2210-XXXX# show users | exclude 0
* You are at this line now.
Connection is from Console.
User name is admin.
Privilege is 15.
! Begin output when specific word is matched:
SWI2210-XXXX# show users | begin Elapsed
Elapsed time is 0 day 21 hour 53 min 29 sec.
Idle time is 0 day 0 hour 0 min 0 sec.