Filtering Show Command Output; Redirecting Show Command Output - Fujitsu XG2000 Series User Manual

Xg2000 series compact, 20-port 10 gigabit ethernet layer 2 switch
Hide thumbs Also See for XG2000 Series:
Table of Contents

Advertisement

XG2000 series User's Guide

2.2.10 Filtering show Command Output

This function allows filtering the show command output so lines that only satisfy specific conditions (filter for strings) are
displayed. This function is useful in excluding unnecessary information from a large amount of output.
To use it, a "show" command must be followed by a keyword (pipe (|), begin, include or exclude) and a regular expression
(filtering condition).
Syntax
show
Keyword for filtering output
begin
exclude
include
xg# show history | begin 2
...skipping
2 configure terminal
3 show running-config
4 show history
5 show history | begin 2
xg# show history | exclude 2
1 enable
3 show running-config
4 show history
xg# show history | include 2
2 configure terminal
5 show history | begin 2
Regular expressions are case sensitive.
For example, if "| exclude strings" is entered, lines that include "String" are output, but those that include "strings" are
not.

2.2.11 Redirecting show Command Output

Redirect the output of "show" commands to a file in volatile memory using ">" (pipe) or "|" (redirect).
show
show
FILE-NAME
Specifies the file name in volatile memory that the output of the command is piped or
redirected.
"| tftp" or "| scp" redirects the output of the show command to a file on a remote server.
show
show
| tftp
Redirects the copy to a file on the TFTP server.
| scp
Redirects the copy to a file on the SSH server.
USERNAME
Specifies the username of the SSH server.
HOST
Specifies the host name or IP address of the TFTP server or SSH server.
REMOTE-FILE
Specifies the file name in the TFTP server or SSH server that the output of the command is
redirected.
In the following example, the current startup-config is redirected as filename "startup_09302005", the running-config file is
redirected as filename "running_09302005", and system information is redirected as filename "system_09302005".
The results of the redirection are confirmed with the "ls" command.
Then, using the "tftp" command, each of these files are moved to the TFTP server.
xg# show startup-config > startup_09302005
xg# show running-config > running_09302005
xg# show system information > system_09302005
xg# ls
(ls command output)
Update-time
- 2005/09/30 11:57:27
- 2005/09/30 11:54:01
- 2005/09/30 11:55:58
xg# tftp put remote-host1 startup_09302005 restore_startup_09302005
xg# tftp put remote-host1 running_09302005 restore_running_09302005
xg# tftp put remote-host1 system_09302005 restore_system_09302005
| {begin | include | exclude} regular-expression
Meaning
Begins output starting at the first line that contains matches to given regular expression
parameters.
Does not display output lines that contain matches to given regular expression parameters.
Displays output lines that contain matches to given regular expression parameters.
Syntax (To redirect the output of a show command to a file in volatile memory:)
> FILE-NAME
| FILE-NAME
Syntax (Redirect the output of a show command to a file on a TFTP server:)
| tftp HOST REMOTE-FILE
Syntax (Redirect the output of a show command to a file on a SSH server:)
| scp USERNAME HOST REMOTE-FILE
File-size File-name
872
system_09302005
2,310
2,437
All Rights Reserved, Copyright (C) PFU LIMITED 2009
startup_09302005
running_09302005
20/315

Advertisement

Table of Contents
loading

Table of Contents