grep - Get Regular-Expression Pattern NAME: grep - Get Regular-Expression Pattern SYNOPSIS: grep [options] regular_expression [ file ...] DESCRIPTION: Grep searches each specified file (if none are specified, it reads stdin) for lines matching the given pattern. Grep allows wild-card file names in the file list. The following options are recognized: -c Only print a count of matching lines. -f Print file name option, see below. -n Preceed each line by its line number. -v Print non-matching lines. The file name is normally printed if more than one file argument is given, or if a wild-card file name was specified. The "-f" flag reverses this action (print name if one file, not if more). The regular_expression defines the pattern to search for. Upper- and lower-case are not distinguished by grep. Blank lines never match. The regular_expression should be quoted. The regular_expression is built out of the following elements: x An ordinary character (not mentioned below) matches that character. '\' The backslash quotes any character. "\$" matches a dollar-sign. '^' A circumflex at the beginning of an expression matches the beginning of a line. '$' A dollar-sign at the end of an expression matches the end of a line. '.' A period matches any character except "new-line". ':a' A colon matches a class of characters described ':d' by the following character. ":a" matches any ':n' alphabetic, ":d" matches digits. ":n" matches ': ' alphanumerics, and ": " matches spaces tabs, and Page 2 grep - Get Regular-Expression Pattern other control characters, such as newline. '*' An expression followed by an asterisk matches zero or more occurrances of that expression: "fo*" matches "f", "fo" "foo", etc. '+' An expression followed by a plus sign matches one or more occurrances of that expression: "fo+" matches "fo", etc. '-' An expression followed by a minus sign optionally matches the expression. '[]' A string enclosed in square brackets matches any character in that string, but no others. If the first character in the string is a circumflex, the expression matches any character except "new-line" and the characters in the string. For example, "A[xyz]+B" matches "AxxB" and "AxyzzyB", while "A[^xyz]+B" matches "AbcB" but not "AxB". A range of characters may be specified by two characters separated by "-". Note that [a-z] matches alphabetics, while [z-a] never matches. The concatenation of regular expressions is a regular expression. DIAGNOSTICS: No arguments Unknown flag No pattern "file_name": cannot open Illegal occurrence operator ... An operator was found in an illegal context. For example, the pattern "*foo" is illegal as the '*' operator must modify a previously specified pattern element. No : type A colon was followed by an unknown modifier. Class terminates badly A character class "[...]" was incorrectly Page 3 grep - Get Regular-Expression Pattern terminated. For example, "[A-]" is incorrect. Unterminated class Character classes must be terminated by ']'. Class too large An internal buffer filled. Empty class A character class must designate something: "[]" is illegal. Pattern too complex An internal buffer filled. AUTHOR: David Conroy, Martin Minow. BUGS: