Pipe Options
The following post processing options are available to deal with the show command outputs. Use the pipe symbol |
after the command and maximum 5 pipes are allowed in a single command.
-
display-json [path <path-value>]
– Display the raw JSON output. Use the optional keywordpath
to filter based on the JSON path expression. except
– Filter lines not matching with the regex pattern. Useignore-case
for case insensitive search.grep
– Filter lines matching with the regex pattern. Useignore-case
for case insensitive search.find
– Search for the first occurrence of a pattern and display all the subsequent lines. Useignore-case
for case insensitive search.no-more
– Display all the lines without paginationsave
– Save the output to file inside mgmt-framework container. Useappend
to append on top of the existing file. Files are stored in mgmt-framework docker. Use the absolute path always. Relative path files are stored in/home/cliadmin
directory.
sonic# show running-config |
display-json Show JSON content
except Show only text that does not match a pattern
find Search for the 1st occurrence of a pattern and display all the subsequent configs
grep Show only text that matches a pattern
no-more Don't paginate output
save Save output to a file
sonic# show running-config | display-json
| Pipe through a command
<cr>
sonic# show running-config | display-json path $..bgp
| Pipe through a command
<cr>
sonic# show running-config | except aaa
ignore-case Case insensitive
| Pipe through a command
<cr>
sonic# show running-config | grep aaa
ignore-case Case insensitive
| Pipe through a command
<cr>
sonic# show running-config | no-more
| Pipe through a command
<cr>
sonic# show running-config | save /tmp/2.txt
append Append output
| Pipe through a command
<cr>
sonic# show running-config | grep pattern1 | except pattern2 | find pattern3 | grep pattern4 | save /tmp/2.txt
append Append output
| Pipe through a command
<cr>