Fujitsu XG2000 Switch User Manual


 
XG2000 series User's Guide
20/315
All Rights Reserved, Copyright (C) PFU LIMITED 2009
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 | {begin | include | exclude} regular-expression
Keyword for filtering output Meaning
begin
Begins output starting at the first line that contains matches to given regular expression
parameters.
exclude
Does not display output lines that contain matches to given regular expression parameters.
include
Displays output lines that contain matches to given regular expression parameters.
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).
Syntax (To redirect the output of a show command to a file in volatile memory:)
show > FILE-NAME
show | FILE-NAME
z 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.
Syntax (Redirect the output of a show command to a file on a TFTP server:)
show | tftp HOST REMOTE-FILE
Syntax (Redirect the output of a show command to a file on a SSH server:)
show | scp USERNAME HOST REMOTE-FILE
z | tftp
Redirects the copy to a file on the TFTP server.
z | scp
Redirects the copy to a file on the SSH server.
z USERNAME
Specifies the username of the SSH server.
z HOST
Specifies the host name or IP address of the TFTP server or SSH server.
z 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 File-size File-name
- 2005/09/30 11:57:27 872 system_09302005
- 2005/09/30 11:54:01 2,310 startup_09302005
- 2005/09/30 11:55:58 2,437 running_09302005
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