Text Processing Tools Grep,eprep and Fgrep:
grep: (Global search regular expression and print out of the line), full search of regular expressions and display of corresponding rows
Text Search Tool: line-by-line search of target files based on user-specified text patterns, showing rows that can be matched by patterns
Format: grep [options] ' PATTERN ' file,..... Text Filter
--color=auto: Add color to the pattern you match to
Example: #grep--color=auto boot/etc/rc.d/rc.sysinit
Build pattern: Called a regular expression, is a pattern written by a type of character (pattern)
Metacharacters: does not represent the meaning of the character itself, for the description of the additional functionality
Basic regular expressions and extended regular expressions:
Basic Regular Expressions: grep
Extended Regular expression: grep-e
Matching mechanism:
1. Match any single character:.
#grep "B.. T "/etc/passwd
#grep--color=auto ' r. T '/etc/passwd
2. Number of occurrences: used to specify the number of occurrences of the preceding character
*: Any time
Example: X*y: Matches with the following several, such as {xxy,xy,y} * before the x can appear once, two times, multiple or 0 times
. *: Any character of any length
\?: matches the preceding character 0 or 1 times
X\?y: There are a few of the following, such as {Xy,y,xxy}, that satisfy the match
Match pattern to greedy mode
\{m\}: Matches M-Times
\{m,n\}: At least m times, up to N times
\{m,\}: At least m times
\{0,n\}: Up to n times
15. Self-Learning Linux path: Text Processing tools Grep,eprep and Fgrep