Summary of the Three Musketeers ' grep command
1. grep
(1) The grep command plus the-v parameter indicates that the content containing Linux is not output
[email protected] data]# CAT ABC
I am Oldboy
Oldboy
Oldgirl
I am studying Linux
I am Eric
[[email protected] data]# GREP-V linux ABC
I am Oldboy
Oldboy
Oldgirl
I am Eric
(2) grep is directly added to Linux, indicating that the output contains the Linux content of the line, grep is output by " line "
[email protected] data]# CAT ABC
I am Oldboy
Oldboy
Oldgirl
I am studying Linux
I am Eric
[[email protected] data]# grep linux ABC
I am studying Linux
(3) grep home plus the usage of the expression ^ denotes what begins with, this example indicates that the output begins with old
[[email protected] data]# grep ^oldboy ABC
Oldboy
[[email protected] data]# grep ^old ABC
Oldboy
Oldgirl
[email protected] data]# CAT ABC
I am Oldboy
Oldboy
Oldgirl
I am studying Linux
I am Eric
(4) grep searches for a character ending with an x character
[[email protected] data]# grep x$ ABC
I am studying Linux
(5) Grep–n with row count output
[email protected] data]# CAT ABC
I am Oldboy
Oldboy
Oldgirl
I am studying Linux
I am Eric
[Email protected] data]# grep-n oldboy ABC
1:i am Oldboy
2:oldboy
Linux grep command