a , function :
the grep command in a Linux system is a powerful text search tool that uses regular expressions to search for text and print matching lines .
Second, usage:
grep [Options] ... PATTERN [FILE] ...
Find the PATTERN in each file or standard input. The default PATTERN is a basic regular expression (abbreviated to BRE).
For example:
Grep-i ' Hello World ' menu.h main.c
Three, the main parameters:
-G, PATTERN is a basic regular expression (abbreviated to BRE)
-P, PATTERN is a Perl regular expression
-E, using PATTERN to perform matching operations
-F, get PATTERN from FILE
-I, ignoring case
-W, forcing PATTERN to match only words exactly
-X, forcing PATTERN to match only one line exactly
-Z, a 0-byte data row, but not empty
' Egrep ' is ' grep-e '. ' Fgrep ' is ' grep-f '. Direct use of ' egrep ' or ' fgrep ' is not available. The standard input is read without the file parameter, or file as-. The-h parameter is used by default if fewer than two file parameters are available. If any row is selected, the exit status is 0, otherwise 1, if there is an error, and the-Q parameter is not specified, the exit status is 2.
Linux--grep command