Open System Services Shell and Utilities Reference Manual (G06.27+, H06.04+)

egrep(1) OSS Shell and Utilities Reference Manual
NAME
egrep - Searches a le for a pattern that is a full regular expression
SYNOPSIS
egrep
[-c | -l]
[-bhinqsvx]
{ pattern ... | -e pattern ... | -f pattern_le ... }
[le ... ]
FLAGS
While most ags can be combined, some combinations result in one ag overriding another. For
example, if you specify both the -n and -l ags, the output includes only lenames (as specied by
the -l ag) and thus does not include line numbers (as specied by the -n ag).
-b Precedes each line by the block number of the block in which it was found. Use this ag
to help nd disk block numbers by context.
-c Displays only a count of matching lines.
-e pattern ...
Species a pattern. This ag works the same as a simple pattern but is useful when the
pattern begins with a - (dash).
-f pattern_file ...
Species a le that contains patterns. Each pattern terminates with a newline character.
-h Suppresses reporting of lenames when multiple les are processed.
-i Ignores the case of letters in locating pattern; that is, uppercase and lowercase letters in
the input are considered to be identical.
-l Lists the name of each le that has lines matching pattern. Each lename is listed only
once; lenames are separated by newline characters.
-n Precedes each line with its relative line number in the le.
-q Suppresses all output except error messages. This ag is useful for easily determining
whether a pattern or string exists in a group of les. When searching several les, it pro-
vides a performance improvement, because it can quit as soon as it nds the rst match,
and it requires less care by the user in choosing the set of les to supply as arguments,
because it exits with a 0 (zero) exit status if it detects a match, even if the egrep com-
mand detected an access or read error on earlier le arguments.
-s Suppresses error messages about inaccessible les.
-v Displays all lines except those that match the specied pattern. This ag is useful for
ltering unwanted lines out of a le.
-x Displays lines that match the pattern exactly with no additional characters.
DESCRIPTION
The egrep command searches the specied les (the standard input le by default) for lines con-
taining characters that match the specied pattern and then write matching lines to the standard
output le.
The egrep command is an obsolescent version of the command grep -E, which searches for pat-
terns that are full regular expressions, except for \( and \), and with the addition of the following
rules:
350 Hewlett-Packard Company 527188-004