Shell of massive data processing grep, cut, awk, sed

GREP

  grep command is an abbreviation Globally search a Regular Expression and Print, showing globally matching and regular print. grep command, including the expansion of related egrep and fgrep, egrep which supports more regular matches, fgrep only match characters and does not support regular expressions.

  

grep [the OPTIONS] [-e the PATTERN | -f FILE] [FILE ...] 

the OPTIONS 
rows -n match also showed up 
-A 3 to 3 lines after the match also showed up 
3 industry before -B 3 matches display out 
-o only a portion of the output matching 
-v reverse match 
-f specified files need to match 


the root @ wdev02: / usr / local / CAT # 1.txt the shell 
123 
345 
the root @ wdev02: / usr / local / CAT # the shell 2.txt 
ABC 
BCD 
123 
haha 
Hehe 
23456 
Hello 
ABCD 
the root @ wdev02: / usr / local / # grep -n. 3 2.txt the shell 
. 3: 123 
. 6: 23456 
the root @ wdev02: / usr / local / # grep -w the shell - 1.txt 2.txt -f n- 
. 3: 123
View Code

 

Guess you like

Origin www.cnblogs.com/ryjJava/p/12465221.html