find text in directory
grep -r 'ENDSSH' ~/sbcode/note
des
grep,egrep,fgrep,rgrep - print lines matching a pattern
print match lines
simples
ll|grep '^a'
grep 'test' aa
显示在aa文件中匹配test的行
=cat file|grep test 相当与这个
grep 'test' aa bb cc
显示在aa,bb,cc文件中匹配test的行
grep -l pattern files
只列出匹配的文件名
grep -L pattern files
列出不匹配的文件名
grep -w pattern files
只匹配整个单词,而不是字符串的一部分(如匹配‘magic’,而不是‘magical’),
grep -C number pattern files
匹配的上下文分别显示[number]行