You can redirect the output of show commands to network files or local files (in NVS memory) using the redirection operators described in Table 5 .
Table 5: Redirect Operators
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