Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Using Pipe Filter Functions

 

You can perform the following tasks by using the pipe filter:

Counting the Number of Lines of Output

To count the number of lines in the output from a command:

  • Enter count after the pipe symbol.

    For example:

Displaying Summarized Output for a Hierarchy Level (SRC CLI)

To display the summarized output of the display level command along with the show command:

Note

The level filter specifies the configuration level for which the summarized output is displayed.

The following example displays the show | display level 1 command output for the hierarchy level 1:

Displaying Output in XML Tag Format

To display command output in XML tag format:

  • Enter display xml after the pipe symbol.

The following example displays the show cli directory command output as XML tags:

Disregarding Output That Does Not Match a Regular Expression

If the regular expression contains any spaces, operators, or wildcard characters, enclose it in quotation marks.

For information about common regular expression operators, see table Common Regular Expression Operators in Operational Mode Commands in Using Regular Expressions with the Pipe Symbol.

To disregard text that matches a regular expression:

  • Specify the except command after the pipe symbol.

The following example displays information about configuration interfaces with the exception of the family information for each interface:

Displaying Output from the First Match of a Regular Expression

When you use regular expressions, enclose any spaces, operators, or wildcard characters in quotation marks.

For information about common regular expression operators, see table Common Regular Expression Operators in Operational Mode Commands in Using Regular Expressions with the Pipe Symbol.

To display output starting with the first occurrence of text matching a regular expression:

  • Enter find after the pipe symbol.

The following example starts displaying information for the show system information command starting with the Current time section of the output:

Displaying the End of the Output for a Command

To display the end of the output for a command:

  • Enter last after the pipe symbol.

The following example shows the end of the output for the show system information command.

Displaying Output That Matches a Regular Expression

If the regular expression contains any spaces, operators, or wildcard characters, enclose it in quotation marks.

For information about common regular expression operators, see table Common Regular Expression Operators in Operational Mode Commands in Using Regular Expressions with the Pipe Symbol.

To display output that matches a regular expression:

  • Enter match  regular-expression after the pipe symbol.

The following example matches all Ethernet interfaces in the interface configuration:

Preventing Output from Being Paginated

By default, if output is longer than the length of the terminal screen, a MORE message lets you display the remaining output when you press the Spacebar. You can use the | no-more filter to display all output at once. This feature is useful when you want access to the entire output, such as to copy the entire output and paste it into an e-mail message.

To prevent the output from being paginated:

  • Enter no-more after the pipe symbol.

    For example, to display all output from the show configuration command at once:

Saving Output to a File

When command output is lengthy, when you need to store or analyze the output, or when you need to send the output in an e-mail or by FTP, you can save the output to a file.

Note

When you run a show command, your SRC privileges determine the information that you view. Therefore, when you save this information, you are saving only the configuration information that you have privileges to view.

By default, the file is placed in the current working directory of the CLI.

To save command output to a file:

  • Enter save filename after the pipe symbol.

The following example saves the output from the show command to a file named my-config-info.txt: