C i s c o C o n f i d e n t i a l - B e t a R e v i e w R 3 . 7. 1
Utility Commands on Cisco IOS XR Software
utility egrep
SMR-749
Cisco ASR 14000 Series Router System Management Command Reference
OL-17231-01
Command History
Usage Guidelines
To use this command, you must be in a user group associated with a task group that includes the proper
task IDs.
The grep utility searches files for character patterns using regular expressions and returns all lines that
contain that pattern. The
utility egrep
command uses full regular expressions (expressions using the full
set of alphanumeric and special characters) to match the patterns.
The results are displayed to the standard output (terminal screen).
Note
Keywords are entered using the displayed syntax, or with UNIX-equivalent syntax. The
UNIX-equivalent syntax is displayed in parentheses () in the syntax description. For example, the
keyword
count
can also be entered using the UNIX-equivalent (
-c
). To display the UNIX-equivalent
syntax online, enter the keyword
usage
.
Task ID
Examples
In the following example, the
utility egrep
command is used to locate the regular expression “uptime”.
The
linenum
keyword is also entered to display the line number before each line of output.
RP/0/RP0/CPU0:router#
show version | utility egrep expr uptime linenum
7:router uptime is 5 days, 19 hours, 27 minutes
In the following example, the
utility egrep
command is used to locate a regular expression in a file. In
this example, all lines with “adm” are displayed. The * character is used as a wildcard.
RP/0/RP0/CPU0:router#
utility egrep expr Adm* nofile file disk0:/usr/passwd
adm:x:4:4:Admin:/var/adm:
lp:x:71:8:Line Printer Admin:/usr/spool/lp:
uucp:x:5:5:uucp Admin:/usr/lib/uucp:
nuucp:x:9:9:uucp Admin:/var/spool/uucppublic:/usr/lib/uucp/uucico
listen:x:37:4:Network Admin:/usr/net/nls:
ssadmin:x:901218:60001:Sun StorEdge(tm) Configuration Service Agent Admin:/:/bin/false
In the following example, the
nocase
keyword is used to ignore the character case:
RP/0/RP0/CPU0:router#
utility egrep expr Adm* nocase file disk0:/usr/passwd
adm:x:4:4:Admin:/var/adm:
lp:x:71:8:Line Printer Admin:/usr/spool/lp:
uucp:x:5:5:uucp Admin:/usr/lib/uucp:
nuucp:x:9:9:uucp Admin:/var/spool/uucppublic:/usr/lib/uucp/uucico
listen:x:37:4:Network Admin:/usr/net/nls:
ssadmin:x:901218:60001:Sun StorEdge(tm) Configuration Service Agent Admin:/:/bin/false
Release
Modification
Release 3.7.1
This command was introduced on the Cisco ASR 14000 Series Router.
Task ID
Operations
universal
execute