Search filter grep (Win under Findstr)
1. Main parameters
[Options] Main parameters:
-C: Outputs only the count of matching rows.
-i: Case insensitive
-H: The file name is not displayed when querying multiple files.
-L: Only file names with matching characters are output when querying multiple files.
-N: Displays matching lines and line numbers.
-S: does not display error messages that do not exist or have no matching text.
-V: Displays all lines that do not contain matching text.
Pattern Regular Expression main parameters:
\: Ignores the original meaning of special characters in regular expressions.
^: matches the start line of the regular expression.
$: Matches the end line of the regular expression.
\<: Starts from the line that matches the regular expression.
\>: End of line to match regular expression.
[]: A single character, such as [a], a meets the requirements.
[-]: range, such as [A-z], i.e. A, B, C to Z all meet the requirements.
.: all the individual characters.
*: There are characters, the length can be 0.
2. example
(1) grep ' test ' d* #显示所有以d开头的文件中包含 Test line
(2) grep ' Test ' AA bb cc #显示在aa, bb,cc file contains test line
(3) grep ' [a-z]\{5\} ' AA #显示所有包含每行字符串至少有5个连续小写字符的字符串的行
(4) grep magic/usr/src #显 The file ( ) contains magic lines
(5) grep-r magic/usr/src #显示/usr/src directory file ( contains subdirectories ) contains Line of Magic
(6) Grep-w pattern files: matches only the entire word , not a part of the string (such as matching ' magic ', not ' magical '),
Search filter grep (win under FINDSTR)