grep (Global Regular Expression print)
How to use:
grep [options] pattern [file1 file2 ...]
make with parameters:
[options] Main parameters:
- C : Counts the number of matching rows (count)
- N : Displays matching lines and line numbers (number)
- v : Reverse match (invert)
- I. : Ignore case (Ignore)
- L : Output only file names that contain matching characters (list of file listings)
- L : Output only file names that do not match the class characters (list of file listings)
- W : Match [pattern] as a word (word)
- v : Version number
--color : match keyword turns red
The main parameters of the pattern regular expression:
\w : match literal and numeric character number [0-9] letter [a-z][a-z]
^ : The beginning of the anchoring line is as follows: ' ^# ' matches all lines beginning with #.
$ : The end of the anchoring line is as follows: ' #$ ' matches all rows ending with $
. &NBSP: Matches a non-newline character such as: ' GR.P ' matches gr followed by an arbitrary character finally B
* : match 0 or more previous characters such as ' *grep ' matches all of one or more spaces followed by the grep line. * Together with any character
[] : match the range of words such as: [Gg]rep match grep and grep
\< : The positional anchor indicates what started as a line, such as \<grep, that represents the line starting with grep (ignoring the spaces preceding the grep)
\> : The positional anchor indicates what started as a line, such as grep\>, that represents the line ending with grep
\b :
x\{m\} : Repeat characters x,m times, such as: ' A\{5\} ' matches rows containing 5 a
x\{m,\} repeat character X, at least m times, such as: ' A\{5,\} ' matches rows with at least 5 a
x\{m,n\} repeat character X, at least m times, not more than n times, such as: ' A\{5,10\} ' matches rows of 5--10 a
This article is from the "11878798" blog, please be sure to keep this source http://11888798.blog.51cto.com/11878798/1856953
Linux Command Text Processing (i) grep