f FILE, -file= FILE Obtain patterns from FILE, one per line. This can be used to specify multiple search patterns, or to protect a pattern beginning with a hyphen ( -). Matching Control -e PATTERN, -regexp= PATTERN Use PATTERN as the pattern.
This is highly experimental and grep -P may warn of unimplemented features. P, -perl-regexp Interpret PATTERN as a Perl regular expression. G, -basic-regexp Interpret PATTERN as a basic regular expression (BRE, see below). F, -fixed-strings Interpret PATTERN as a list of fixed strings, separated by newlines, any of which is to be matched. Matcher Selection -E, -extended-regexp Interpret PATTERN as an extended regular expression (ERE, see below). This version number should be included in all bug reports (see below). V, -version Print the version number of grep to the standard output stream. Print a usage message briefly summarizing these command-line options and the bug-reporting address, then exit. Direct invocation as either egrep or fgrep is deprecated, but is provided to allow historical applications that rely on them to In addition, two variant programs egrep and fgrep are available.
By default, grep prints the matching lines. Grep searches the named input FILEs (or standard input if no files are named, or if a single hyphen-minus ( -) is given as file name)įor lines containing a match to the given PATTERN.