Home > OS >  Linux three musketeers grep set awk
Linux three musketeers grep set awk

Time:09-23

grep
Only the three musketeers regular support
Role: text filtering, add color to filter out content (the default centos7, other versions need to manually add)
 grep -o "root"/etc/passwd 
-o show only match the content of the


 grep -w "root"/etc/passwd 
- w exact match filtering out root


 grep "root"/etc/passwd 
Filter out the "root" contains rows containing the root characters


 - w and directly with the difference between the "root" 
- w is a precise filter, such as dfkdlfrootjdj represents a line, w. filter does not show this line, and grep -o "root"/etc/passwd will filter out the line

 grep -n "root"/etc/passwd 
-n filtering out of the line in the file containing the root line number


 grep -n "root"/etc/passwd 
-r recursive filter, filter the current directory containing all the files and directories "root" all the files and directories


 grep -c "root"/etc/passwd 
-c statistics including root how many rows


 grep -i "root"/etc/passwd 
-i said filter ignore case when


 grep - A2 "root"/etc/passwd 
The grep - B2 "root"/etc/passwd
The grep - C2 "root"/etc/passwd
Line - A representative filter out with root and down the two lines
- B on behalf of the filter out lines contain root and up two
- C, filter out the line containing the root and down and up two rows


Under the regular chapter

CodePudding user response:

 to write well, is the color is too bright
  • Related