Grep
-I is case insensitive
--color Adding colors
Alias Grep=grep ' grep--color
-V displays rows that are not matched by the pattern
-O displays only strings that are matched by the pattern
Review:
* Any character of any length
? Any single character
[] within the specified range
[^] outside the specified range
Regular Expressions: Regular expression, (REGEXP)
Metacharacters
. Match any single character
* Match its preceding characters any time (greedy mode)
.*
? Match its preceding character 1 or 0 times (\)
\{m,n\} matches its preceding character at least m times, more than n times
Example: \{1,\} \{,3\}
^ Anchor Beginning
$ Anchor Line End
^$ Blank Line
[] matches any single character in the specified range
[^] matches any single character outside the specified range
[:d Igit:] Number
[: Lower:] lowercase letters
[: Upper:] Uppercase
[:p UNCT:] Punctuation
[: Space:] white space characters
\< or \b Anchor Word, any character after it must appear as the first word
\> or \b Anchors the ending, and any character in front of it must appear as the tail of the word
Example:\<root\>
\ (\) group
Example: \ (ab\) *
\1 refers to the first opening parenthesis and the contents of the corresponding closing parenthesis
Example: \ (L). e\). *\1
Linux under grep command notes