My grep-a-like program ack has a -1 option that stops at the first match found anywhere. It supports the -m 1 that @mvp refers to as well. I put it in there because if I'm searching a big tree of source code to find something that I know exists in only one file, it's unnec...
Print the file name for each match. This is the default when there is more than one file to search. 打印每个匹配项的文件名。当需要搜索多个文件时,这是默认设置。 -h, --no-filename Suppress the prefixing of file names on output. This is the default when there is only one file (or on...
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.Thisoption has no effectif-xisalso specified.-x,--line-regexpSelectonly those matches that exactly match the ...
Open the matching files in the pager (not the output ofgrep). If the pager happens to be "less" or "vi", and the user specified only one pattern, the first file is positioned at the first match automatically. Thepagerargument is optional; if specified, it must be stuck to the option...
Open the matching files in the pager (not the output ofgrep). If the pager happens to be "less" or "vi", and the user specified only one pattern, the first file is positioned at the first match automatically. Thepagerargument is optional; if specified, it must be stuck to the option...
-H, --with-filename Print the file name for each match. This is the default when there is more than one file to search. -h, --no-filename Suppress the prefixing of file names on output. This is the default when there is only one file (or only standard input) to search. ...
-v, --invert-match Invert matching. Show lines that do not match the given patterns. -w, --word-regexp Only show matches surrounded by word boundaries. This is roughly equivalent to putting \b before and after all of the search patterns. ...
如果指定-I或--binary-files=without-match选项,则二进制文件即使包含相应字符串,也当做不包含该内容处理。 $ grep -rnwlI sec_read_otp_bit . ./security/verify_ssbl.c ./security/boot_defines.h ... ./objs/7260b0/security/bsp_utils.i
grep -v 命令 -v 或 --revert-match : 显示不包含匹配文本的所有行。 实际应用. 如下面文档(摘自redis.conf) # for connections from all the network interfaces available on the server. # It is possible to listen to just one or multiple selected interfaces using # the "bind" configuration directi...
Not all regular expressions are the same. The term describes the process of inventing patterns to match something. Anyone can invent a schema for regular expressions, and sogrep's regex is only one ruleset among many. The best place to start learning regex forgrepis its GNU info page, in ...