Using Pipe (|) Filter Functions
Pipe (|) Filter Functions
This topic describes the pipe (|) filter functions supported in the Pica8 PicOS L2/L3 CLI (command-line interface). The PicOS L2/L3 mode has a growing number of CLI commands that users can use to troubleshoot common problems. These commands usually generate a lot of output. The use of pipe (|) filter functions increases readability of command output, making troubleshooting more effective.
The following filter functions are available with the PicOS L2/L3:
Function | Description |
---|---|
compare | Compare configuration changes with a prior version |
count | Count occurrences |
display | Display additional configuration information |
except | Show only the lines of output that do not contain a pattern |
find | Show output starting from the first occurrence of a pattern |
match | Show only the lines of output that contain a pattern |
no-more | Disable pagination of command output |
Comparing Configurations
The compare filter compares the current committed configuration with a previously committed configuration.
admin@XorPlus# show | compare rollback nn
nn is the index into the list of previously committed configurations, also known as the rollback number. The range of values for nn is 01-48.
For example:
admin@XorPlus# show | compare rollback 03
Counting the Number of Output Lines
To count the number of lines in the output of a command, enter count after the pipe symbol (|).
The following example uses count with the show command in configuration mode to display the number of non-default configuration lines:
admin@XorPlus# show | count Count: 11 lines
Displaying Output that Matches a Pattern
To display only the lines of output that match a pattern, enter match after the pipe symbol (|).
The following example displays the status of only TbE (terabit Ethernet) interfaces:
admin@XorPlus> show interface brief | match te- te-1/1/1 Enabled Down Disabled Full Auto te-1/1/2 Enabled Down Disabled Full Auto te-1/1/3 Enabled Down Disabled Full Auto te-1/1/4 Enabled Down Disabled Full Auto te-1/1/5 Enabled Down Disabled Full Auto te-1/1/6 Enabled Down Disabled Full Auto te-1/1/7 Enabled Down Disabled Full Auto te-1/1/8 Enabled Down Disabled Full Auto te-1/1/9 Enabled Down Disabled Full Auto te-1/1/10 Enabled Down Disabled Full Auto <Some output omitted>
Omitting Output that Matches a Pattern
To omit lines from the output of a command that make up a pattern, enter except after the pipe symbol (|).
The following example uses except with the show interface brief command in the operation mode to list the interfaces that are not down:
admin@XorPlus> show interface brief | except Down
Preventing Output from Being Paginated
By default, if the output of a command is longer than the length of terminal screen, user will see the --More-- message to display the remaining output. Press the space bar to display the remaining output.
User can disable pagination by entering no-more after the pipe symbol (|).
The following example displays the output of show command, executed in PicOS L2/L3 configuration mode, all at once:
admin@XorPlus# show | no-more
This feature is useful, for example, when user wants to copy the entire output of a command and paste it into an e-mail to be sent to technical support.
Copyright © 2025 Pica8 Inc. All Rights Reserved.