grep searches the named input FILEs for lines containing a match to the given PATTERN. If no files are specified, or if the file “-” is given, grep searches standard input. By default, grep prints the matching lines. grep在命名的输入文件中搜索与给定模式匹配的行。如果没有指定文件,或者给...
If the first few bytes of a file indicate that the file contains binary data, assume(假定) that the file(二进制文件) is of type TYPE. By default, TYPE isbinary, and grep normally outputs either aone-line messagesaying that a binary file matches, or no message if there is no match. I...
Concatenation Two regular expressions may be concatenated; the resulting regular expression matches any string formed by concatenating two substrings that respectively match the concatenated expressions. Alternation Two regular expressions may be joined by the infix operator |; the resulting regular expressi...
空文件包含零个匹配项,因此不匹配任何内容 -i,--ignore-case 忽略匹配项的大小写 -v,--invert-match 反向匹配,选择没有匹配上的行 -w,--word-regexp 仅匹配完整单词,匹配的子字符串必须位于行的开头,或者前面有一个非字词字符。类似地,它必须位于 行尾或后面跟非字词组成字符(字词组成字符是字母、数字和下...
By default, as soon as one pattern matches (or fails to match when -v is used), no further patterns are considered. However, if --colour (or --color) is used to colour the matching substrings, or if --only-matching, --file-offsets, or --line-offsets is used to output only ...
If you prefer that grep only print the phrases that match exactly (i.e., have spaces around them and are not substrings of other words), you can use the -w/--word-regexp flag to enable whole word matching. You can use the same idea to match phrases if they appear as a single li...
Two regular expressions may be concatenated; the resulting regular expression matches any string formed by concatenating two substrings that respectively match the concatenated expressions. Alternation Two regular expressions may be joined by the infix operator |; the resulting regular expression matches any...
If the specified capturing parentheses do not exist in the pattern, or were not set in the match, nothing is output unless the file name or line number are being output. If this option is given multiple times, multiple substrings are output, in the order the options are given. For ...
If the specified capturing parentheses do not exist in the pattern, or were not set in the match, nothing is output unless the file name or line number are being output. If this option is given multiple times, multiple substrings are output for each match, in the order the options are ...
lines containing a match to the given PATTERN. By default, grep prints the matching lines. OPTIONS Matching Control -e PATTERN, --regexp=PATTERN Use PATTERN as the pattern. This can be used to specify multiple search patterns, or to protect a pattern beginning with a hyphen ...