grep [OPTION...] PATTERNS [FILE...]
grep [OPTION...] -e PATTERNS ... [FILE...]
grep [OPTION...] -f PATTERN_FILE ... [FILE...]
grep, egrep, fgrep - print lines that match patterns 按格式查找文件里对应的内容
-
常用选项
-i:ignore case distinctions 搜索时候忽略大小写 -v:select non-matching lines 反转选项 -w:force PATTERN to match only whole words 精确匹配单词,单词的两边必须是非字符符号(即不能是字母数字或下划线) -c:print only a count of matching lines per FILE 为每个输入文件打印匹配线的计数 -s:suppress error messages 不会输出查找过程中出现的任何错误消息