Controlling Output
The CLI allows you many ways to control and save the output of a command.
--More--
The CLI supports a MORE facility to control the amount of output when a large amount of data is displayed. After a screen's worth of data is displayed, a "--More--" prompt is shown at the bottom of the screen and the output is suspended until the user types in one of the following keys:
<SPACE> to display the next screen's worth of data or remaining output.
<CR> to scroll down one line.
<q> or <SHIFT><q> to terminate the command.
The number of lines displayed is determined by the screen size values that are sent in by the Telnet or SSH client. The number of lines that are displayed for each screen of a MORE displayed are the screen size less 1 line for the "--More--" prompt.
For example:
bti7800# show equipment
Chassis PEC Admin State Oper State Custom1 Custom2 --------------- ----------- ----------- ---------- ------------------ ------- chassis:1 BT8A78CH14 enabled up Module PEC Admin State Oper State Custom1 Custo ---------- -------------- ----------- -------------- ------------------ ----- amp:1/4 BT8A78AMP1 enabled down cmm:1/A BT8A78CMM1 enabled up cmm:1/B BT8A78CMM1 enabled up fan:1/1 BT8A78FAN1 enabled up fan:1/2 BT8A78FAN1 enabled up fan:1/3 BT8A78FAN1 enabled up fan:1/4 BT8A78FAN1 enabled up fan:1/5 BT8A78FAN5 enabled up fan:1/6 BT8A78FAN5 enabled up ila:1/5 BT8A78AMPL enabled down --More--
Filtering Output with the Pipe (|) Output Modifier
The pipe (|) output modifier allows you filter output as well as to save the output to a file. The supported options are shown in the following table:
Option | Description |
---|---|
append file | Appends the output to the specified file. |
begin string | Displays output beginning at the line that contains the specified string. |
count | Displays a count of the number of lines of output. |
exclude string | Displays lines that do not contain the specified string. |
include string | Displays lines that only contain the specified string. |
linnum | Enumerates lines in the output. |
more | Displays a full screen's worth of lines followed by a --More-- prompt. |
nomore | Displays output in its entirety without the --More-- prompt. This is useful when saving the output to a file. |
save file [ overwrite ] | Saves the output to the specified file with the option to overwrite the specified file if the specified file already exists. |
until string | Displays lines up to and including the line that contains the specified string. |
You can use multiple pipes in the same command. The order that you enter the pipes dictates the order that the pipes are executed. See example.
For example:
bti7800# show equipment | include cmm | linnum
1: cmm:1/A BT8A78CMM1 enabled up 2: cmm:1/B BT8A78CMM1 enabled up
bti7800# show equipment | linnum | include cmm
8: cmm:1/A BT8A78CMM1 enabled up 9: cmm:1/B BT8A78CMM1 enabled up