Understanding the Command-Line Interface
less Utility
You can use the less utility to display the contents of the show command output one screen at a time. You
can enter less commands at the : prompt. To display all less commands you can use, enter h at the : prompt.
Mini AWK Utility
AWK is a simple but powerful utility to summarize text output. You can use this utility after a pipe (|) to
further process the text output of a command. Cisco NX-OS supports a mini AWK, which takes an inline
program as an argument.
This example shows how the mini AWK utility can be used to summarize the text output of the show ip route
summary vrf all command:
switch# show ip route summary vrf all | grep "Total number of routes"
Total number of routes: 3
Total number of routes: 10
switch# show ip route summary vrf all | grep "Total number of routes" | awk '{ x = x + $5}
END { print x }'
13
sed Utility
You can use the Stream Editor (sed) utility to filter and manipulate the show command output as follows:
sed command
The command argument contains sed utility commands.
sort Utility
You can use the sort utility to filter show command output.
The sort utility syntax is as follows:
sort [-M] [-b] [-d] [-f] [-g] [-i] [-k field-number[.char-position][ordering]] [-n] [-r] [-t delimiter] [-u]
This table describes the sort utiliity parameters.
Table 14: sort Utility Parameters
Parameter
-M
-b
-d
-f
Description
Sorts by month.
Ignores leading blanks (space characters). The default
sort includes the leading blanks.
Sorts by comparing only blanks and alphanumeric
characters. The default sort includes all characters.
Folds lowercase characters into uppercase characters.
Cisco Nexus 9000 Series NX-OS Fundamentals Configuration Guide, Release 7.x
less Utility
67