grep full name is: Global search Regular expression and printing globally searches for regular expressions and displays them
Use regular expressions to describe the selection criteria.
Pick row selection, select a row's filter criteria, and, given the selection criteria, display only the rows that match the criteria, or only those that do not match the criteria.
There are three commands for a similar operation: grep; Egrep Fgrep
grep: The default support for basic regular expressions;
Egrep: extended regular expression;
Fgrep: The regular expression metacharacters are not supported and the search string is fast;
Regular expressions are patterns written by a class of characters (pattern)
Metacharacters: does not represent the meaning of the character itself, but is used for the description of the additional functionality;
Using a bunch of meta-characters, not representing the meaning of the metacharacters themselves, but representing the characters used to describe the function, and this description of the function or functional description of the expression written, we call it a regular expression.
Using a class of metacharacters that do not represent itself, the pattern described by combining other characters with the ability to match or conform to a pattern character is called a regular expression.
Method: grep [options] ' pattern ' file means to find a line in this file that conforms to the write pattern and display it. ' Pattern ' is used to describe the search criteria.
Example: Displaying a line that includes the root character in user attribute information
#grep ' Root '/etc/passwd
You can also highlight the results you have found;
#grep--color=auto ' root '/etc/passwd
Not to be continued
This article is from the "IT" blog, so be sure to keep this source http://yycjqr.blog.51cto.com/6587335/1410059