Filtering Show Command Output; Redirecting Show Command Output - Fujitsu XG700 - Switch User Manual

User guide
Hide thumbs Also See for XG700 - Switch:
Table of Contents

Advertisement

XG700 User's Guide

2.2.10 Filtering show Command Output

This function allows you to filter show command outputs to extract the lines that satisfy specific conditions (filter for strings).
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 users
4 show history
xg# show history | include 2
2 configure terminal
5 show history | begin 2
Regular expressions are case sensitive.
For example, if you enter "| exclude strings", lines that include "String" are output, but those that include "strings" are not.

2.2.11 Redirecting show Command Output

You can redirect the output of "show" commands to a file in volatile memory using ">" or "| redirect".
Syntax (To redirect the output of a show command to a file in volatile memory:)
show
show
FILE-NAME
Specify a file name in the volatile memory to which the output of the command is redirected.
"| tftp" allows you to directly redirect the output of a show command to a file in a TFTP server.
Syntax (To directly redirect the output of a show command to a file in a TFTP server:)
show
HOST
Specify a host name or IP address of the TFTP server.
REMOTE-FILE
Specify the file name in the TFTP server to which 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 is 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
In the following example, show command output is directly redirected to TFTP server "remote-host1" using "| tftp".
xg# show startup-config | tftp remote-host1 restore_ startup_09302005
xg# show running-config | tftp remote-host1 restore_running_09302005
xg# show system information | tftp remote-host1 restore_system_09302005
| {begin | include | exclude} regular-expression
Meaning
Begins output starting at the first line that matches given regular expression parameters.
Displays output lines that do not contain those lines that match given regular expression
parameters.
Displays output lines that match given regular expression parameters.
> FILE-NAME
| redirect FILE-NAME
| tftp HOST REMOTE-FILE
File-size File-name
872
system_09302005
2,310
startup_09302005
2,437
running_09302005
19/266
All Rights Reserved, Copyright (C) PFU LIMITED 2005-2006

Advertisement

Table of Contents
loading

Table of Contents