Table 4: Redirect Operators (continued)
Redirect Operator
Use
&>
Redirects output to the specified file, overwriting the file if
it already exists, and displays the output on the screen. The
redirection is synchronized with the screen display; for
example, if a --More-- prompt appears, the redirection halts
until you take further action.
&>>
Appends output to the end of the specified file and displays
the output to the screen. The redirection is synchronized
with the screen display; for example, if a --More-- prompt
appears, the redirection halts until you take further action.
For example, you can redirect the output of the show config command to a script
file and later run that script:
host1#show config > showconfig.scr
The following command writes the output to a text file, version.txt, on a remote
router:
host1#show hardware > pc:/erxfiles/version.txt
The following command appends the output to version.txt:
host1#show hardware >> version.txt
Only one instance of a file can be open for file redirection. An error message is
generated if you attempt to redirect output to a file that is already open. You cannot
redirect output to a file that includes a local path in the filename.
You can use redirection with output filtering. The general syntax is:
show options [ { > | >> | &> | &>> } filename ]
[ | { begin | include | exclude } filterstring ]
The filtering is performed before redirection. In the following example, the cnfgfltr.txt
file will contain the output of show config include-defaults beginning with the first
occurrence of the string inter.
host1#show config include-defaults &> cnfgfltr.txt | begin inter
Regular Expressions
A regular expression uses special characters often referred to as metacharacters to
define a pattern that is compared with an input string. You can use regular expressions
to filter the output of show commands and to define AS-path access lists and
community lists to more easily filter routes.
For examples of using regular expressions with AS-path access lists and community
lists, see JUNOSe IP Services Configuration Guide.
Chapter 2: Command-Line Interface
Overview
41
Need help?
Do you have a question about the SYSTEM BASICS - CONFIGURATION GUIDE V 11.1.X and is the answer not in the manual?
Questions and answers