“每天一命令之grep”的版本间的差异

来自linux中国网wiki
跳到导航 跳到搜索
第5行: 第5行:
 
ps -ef | grep  -E 'tomcat1 |tomcat2 |grep -v grep '
 
ps -ef | grep  -E 'tomcat1 |tomcat2 |grep -v grep '
  
grep -rn  sth  somefiles
+
grep -rn  sth  somefiles #比dat 好
 
</pre>
 
</pre>
  

2019年11月29日 (五) 06:10的版本

常用参数

#多个and 
ps -ef | grep  -E 'tomcat1 |tomcat2 |grep -v grep '

grep -rn   sth  somefiles #比dat 好

find & grep 总结

精准 非贪婪匹配

 -w, --word-regexp         强制 PATTERN 仅完全匹配字词
              Select  only  those  lines containing matches that form whole words.  The test is that the matching substring must either be at the beginning of the line, or preceded by a
              non-word constituent character.  Similarly, it must be either at the end of the line or followed by a non-word  constituent  character.   Word-constituent  characters  are
              letters, digits, and the underscore.  This option has no effect if -x is also specified.