Grep - Compaq AlphaServer ES45 Service Manual

Hide thumbs Also See for AlphaServer ES45:
Table of Contents

Advertisement

4.9

grep

The grep command is very similar to the UNIX grep command. It
allows you to search for "regular expressions"—specific strings of
characters—and prints any lines containing occurrences of the strings.
Using grep is similar to using wildcards.
Example 4–7 grep
P00>>> show fru | grep PCI
SMB0.CPB0.PCI1
0 DE500-BA Network Cont
SMB0.CPB0.PCI4
0 DEC PowerStorm
SMB0.CPB0.PCI5
0 NCR 53C895
P00>>>
In Example 4–7 the output of the show fru command is piped into grep (the
vertical bar is the piping symbol), which filters out only lines with "PCI."
Grep supports the following metacharacters:
^
Matches beginning of line
Matches end of line
$
.
Matches any single character
[ ]
Set of characters; [ABC] matches either 'A' or 'B' or 'C'; a dash (other than first or
last of the set) denotes a range of characters: [A-Z] matches any uppercase letter;
if the first character of the set is '^' then the sense of match is reversed: [^0-9]
matches any non-digit; several characters need to be quoted with backslash (\) if
they occur in a set: '\', ']', '-', and '^'
*
Repeated matching; when placed after a pattern, indicates that the pattern
should match any number of times. For example, '[a-z][0-9]*' matches a lowercase
letter followed by zero or more digits.
+
Repeated matching; when placed after a pattern, indicates that the pattern
should match one or more times '[0-9]+' matches any non-empty sequence of
digits.
?
Optional matching; indicates that the pattern can match zero or one times.
'[a-z][0-9]?' matches lowercase letter alone or followed by a single digit.
\
Quote character; prevent the character that follows from having special meaning.
SRM Console Diagnostics 4-23

Advertisement

Table of Contents
loading

Table of Contents