Linux命令之grep用法

Linux命令之grep用法

Usage: grep [OPTION]… PATTERN [FILE]…
用法: grep [选项]…模式 [文件]。

Search for PATTERN in each FILE or standard input.
在每个文件或标准输入中搜索模式。
PATTERN is, by default, a basic regular expression (BRE).
默认情况下, 模式是基本正则表达式 (BRE)。
Example: grep -i ‘hello world’ menu.h main.c

Regexp selection and interpretation:
-E, --extended-regexp PATTERN is an extended regular expression (ERE)
模式是扩展正则表达式 (ERE)
-F, --fixed-strings PATTERN is a set of newline-separated strings
模式是一组换行符分隔的字符串
-G, --basic-regexp PATTERN is a basic regular expression (BRE)
模式是基本正则表达式 (BRE)
-P, --perl-regexp PATTERN is a Perl regular expression
模式是 Perl 正则表达式
-e, --regexp=PATTERN use PATTERN for matching
使用模式进行匹配
-f, --file=FILE obtain PATTERN from FILE
从文件获取模式
-i, --ignore-case ignore case distinctions
忽略案例区分
-w, --word-regexp force PATTERN to match only whole words
强制模式仅匹配整个单词
-x, --line-regexp force PATTERN to match only whole lines
强制模式仅匹配整行
-z, --null-data a data line ends in 0 byte, not newline
数据行以0字节结尾, 而不是换行符

猜你喜欢

转载自blog.csdn.net/Baron_wu/article/details/83246414