grep [options] pattern [FILE]grep:命令本身[options]:命令修饰符pattern:要找到的搜索查询[FILE]:命令将要搜索的文件 示例:grep -i abc output.txt 如果FILE是-,则从标准输入中读取数据(不递归),如果没有提供FILE,则在当前目录递归搜索。三、常用选项 通用程序信息 --help:输出帮助信息-V, --version...
输出行的前缀控制(Output Line Prefix Control): 当要输出多个前缀字段时,顺序始终是文件名,行号和字节偏移量,无法指定顺序。 --b``--byte-offset:在每行输出之前打印在输入文件中基于 0 的字节偏移量。如果指定了-o(--only-matching),则打印匹配部分本身的偏移量。当 grep 在 MS-DOS 或 MS-Windows 上运行...
抑制正常的输出,打印匹配到的文件名 -m[NUM], --max-count=NUM:指定匹配查找读取的行数,如果[NUM]为0,则会立即停止读取,默认值为-1,表示无限读取 -o, --only-matching:仅仅打印匹配到的行 -q, --quiet, --silent:不输出任何东西,静音模式 -s, --no-messages:抑制错误信息,关于不存在或不可读的文件...
Print the 0-based byte offset within the input file before each line of output. If '-o' ('--only-matching') is specified, print the offset of the matching part itself. When 'grep' runs on MS-DOS or MS-Windows, the printed byte offsets depend on whether the '-u' ('--unix-byte...
抑制正常的输出,打印匹配到的文件名 -m[NUM], --max-count=NUM:指定匹配查找读取的行数,如果[NUM]为0,则会立即停止读取,默认值为-1,表示无限读取 -o, --only-matching:仅仅打印匹配到的行 -q, --quiet, --silent:不输出任何东西,静音模式 -s, --no-messages:抑制错误信息,关于不存在或不可读的文件...
-o或--only-matching:只打印出匹配正则表达式的文本,不打印出所在的行 [root@izj6cid7b1uq3w3cmzmf7ez ~]# grep -o "export" .bash_profile export 1. 2. -q或--quiet或--slient:不输出任何信息 -d <动作>或--directories=<动作>:当指定的路径是文件夹而非文件时,需要使用该参数。“动作”参数主要...
B <nums>, output nums line before each match exclude-dir <dir pattern>, supportregexp include-dir <dir pattern>, exclude-dir have a higher priority ooronly-matching, only output matching part in the capture line Rorr, recursive directory ...
suppress the file name prefix on output --label=LABEL use LABEL as the standard input file name prefix -o, --only-matching show only the part of a line matching PATTERN -q, --quiet, --silent suppress all normal output --binary-files=TYPE assume that binary files...
Output Line Prefix Control -b, --byte-offset Print the 0-based byte offset within the input file before each line of output. If -o (--only-matching) is specified, print the offset of the matching part itself. -H, --with-filename Print the file name for each match. This is the ...
--no-filename suppress the file name prefix on output--label=LABEL use LABEL as the standard input file name prefix-o,--only-matching 只显示匹配PATTERN 部分的行-q,--quiet, --silent 不显示所有常规输出--binary-files=TYPE 设定二进制文件的TYPE 类型;TYPE可以是`binary', `text', 或`without-...