First, grep
grep family
grep, Egrep, Fgrep
Globally search a Regular Expression and Print
Find according to the pattern we provide and display the matching lines in the file
Pattern: pattern, a match condition consisting of a pure string or a meta-character
grep works in greedy mode
Grep
grep [OPTIONS] PATTERN [FILE ...] --Color: Displays the part of the matching pattern in a highlighted color -I: Ignore case to match -V: Invert selection, show no match to -o: Show only matched characters - E: Using an extended regular expression -a#: (after) displays the line that is matched by the condition and its next # line -b#:(before) displays the line that is matched by the condition and its preceding # row -c#: (context) shows the line that is matched by the condition and the # lines before and after it
Second, the regular expression of the meta-character 1, the basic regular expression
1 . Matches of character or string occurrences *: The characters in front of it appear 0 or any time \? : The preceding character appears 0 or 1 times \{m,n\}: The preceding character appears at least m times, with a maximum of n times 2 . Wildcard.: Any single character []: any single character in the specified range [ ^ 3 . Anchoring character ^: anchor at the beginning of the line, usually followed by ^ must appear at the beginning of the $: End anchor, usually written in front of the string must appear at the end of the row \ < > 4 . Group symbol \ (\): Group \ 1 : references the first pair of parentheses in the contents \ 2 3
2. Extended Regular Expression grep-e = Egrep
+: The preceding character appears at least once | : or () grouping can not write escape characters grep basic Regular expression, meta-character Egrep extended Regular expression, meta-character fgrep Pure string
"Regular expression of Linux"