Open System Services Shell and Utilities Reference Manual (G06.25+, H06.03+)
Table Of Contents
fgrep(1) OSS Shell and Utilities Reference Manual
\special_character
A \ (backslash) followed by a special pattern-matching character matches the special
character itself (as a literal character). These special pattern-matching characters are as
follows:
.*[\ Always special, except when they appear within [](brackets).
^ Special at the beginning of an entire pattern or when it immediately follows
the left bracket of a pair of brackets ([ˆ...]).
$ Special at the end of an entire pattern.
[: :] A character class name enclosed in bracket-colon delimiters matches any of the set of
characters in the named class. Members of each of the sets are determined by the current
setting of the LC_CTYPE environment variable. The supported classes are alpha,
upper, lower, digit, xdigit, space, print, punct, graph, and cntrl. Here is an example
of how to specify one of these classes:
[[:lower:]]
This matches any lowercase character for the current locale.
Forming Patterns
The following rules describe how to form patterns from REs:
• An RE that consists of a single, ordinary character matches that same character in a string.
• An RE followed by an * (asterisk) matches zero or more occurrences of the character that
the RE matches. For example, the following pattern:
ab*cd
matches each of the following strings:
acd
abcd
abbcd
abbbcd
but not the following string:
abd
If there is any choice, the leftmost longest matching string is chosen. For example, given
the following string:
122333444
the pattern .* matches 122333444, the pattern .*3 matches 122333, and the pattern .*2
matches 122.
3−130 Hewlett-Packard Company 527188-003