General Commands Manual:GREP(1)
- grep, egrep, fgrep, rgrep - print lines matching a pattern
- grep [OPTIONS] PATTERN [FILE…]
- grep [OPTIONS] [-e PATTERN | -f FILE] [FILE…]
- 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) for lines containing a match to the given PATTERN. By default, grep prints the matching lines.
- In addition, three variant programs egrep, fgrep and rgrep are available. egrep is the same as grep -E. fgrep is the same as grep -F. rgrep is the same as grep -r. Direct invocation as either egrep or fgrep is deprecated, but is provided to allow historical applications that rely on them to run unmodified.
Generic Program Information
- –help Print a usage message briefly summarizing these command-line options and the bug-reporting address, then exit.
- -V, –version
- Print the version number of grep to the standard output stream.This version number should be included in all bug reports (see below).
- Interpret PATTERN as an extended regular expression (ERE, see below). (-E is specified by POSIX.)
- Interpret PATTERN as a list of fixed strings, separated by newlines, any of which is to be matched. (-F is specified by POSIX.)
- Interpret PATTERN as a basic regular expression (BRE, see below). This is the default.
- Interpret PATTERN as a Perl regular expression (PCRE, see below). This is highly experimental and grep -P may warn of unimplemented features.
- Matching Control
- General output Control
- Output Line Prefix Control
- Context Line Control
- File and Directory Selection
- Other Options
- Character Classes and Bracket Expressions
- The Backslash Character and Special Expressions
- Back References and Subexpressions
- Basic vs Extended Regular Expressions
- LC_ALL, LC_COLLATE, LANG
- LC_ALL, LC_CTYPE, LANG
- LC_ALL, LC_MESSAGES, LANG
- Reporting Bugs
- Known Bugs
- Regular Manual Pages
- POSIX Programmer’s Manual Page
- TeXinfo Documentation