Regular Expression
\ <The \>: exact match of the, excluding words containing
[^ B-d]: does not contain B ~ D
A \ {2 \}: A appears twice
A \ {2, 3 \}: A appears 2 ~ 3 times
A \ {2 ,\}: A appears at least twice
[: Upper:]: uppercase letters (when used, add a layer of [] to indicate matching Character Set combination)
[: Lower:]: lowercase letter
[: Digit:]: Number
[: Alnum:]: uppercase/lowercase letters and numbers
[: Space:]: space or tab key
[: Alpha:]: uppercase/lowercase letters
Wildcard
Note that the wildcard is different from the regular expression, although there are common symbols
Ls-L *. Sh
Matches the file ending with. Sh, and * Indicates 0 or multiple prefix characters in the regular expression.
Ls-l 0 ?. Sh
Match the file that starts with 0 and ends with a character, ending with. Sh, and? Represents 0 or 1 character in an extended regular expression.
[] And [^] are used in the same way as regular expressions.
Grep
Text Search Tools
Grep [Option] [mode] [file]
-C only outputs the number of matched Korean
-I case-insensitive
-L only list matching file names, not specific Matching lines
-N: Lists All matched rows and displays row numbers.
-S does not display error messages that do not exist or do not match the text
-R recursive search not only searches for the current working directory, but also subdirectories
-Q: no result is output. Exit indicates whether the search is successful.
-E supports extended regular expressions.
-F does not support regular expressions and matches strings according to their literal meanings.
-H: When querying multiple files, the file name is not displayed.
-B prints the offset of the matched line spacing header, in bytes. If combined with-o, it is the offset of the matching word from the header.
-W matches the entire word, that is, the metacharacters of the regular expression in the pattern are not interpreted as special meanings. For example, CER * Is CER *
-X matches the entire line, that is, if word * is matched, the line of words can be word *.
Note: If the mode has spaces, use quotation marks. The file name can use wildcards (note that it is not a regular expression).-At the beginning must also be added to \ for transfer (think-option)
This article is from the "flyclc" blog, please be sure to keep this source http://flyclc.blog.51cto.com/1385758/1540161