The fundamental building blocks are the regular expressions that match a single character. Most characters, including all letters and digits, are regular expressions that match themselves. Any meta-character with special meaning may be quoted by preceding it with a backslash. 基本的构建块是匹配单个字...
--include=FILE_PATTERN search only files that match FILE_PATTERN --exclude=FILE_PATTERN skip files and directories matching FILE_PATTERN --exclude-from=FILE skip files matching any file pattern from FILE --exclude-dir=PATTERN directories that match PATTERN will be skipped. -L, --files-without-...
--colour[=WHEN]use markers to highlight the matching strings;WHEN is'always','never', or'auto'-U, --binarydonot strip CR characters at EOL(MSDOS/Windows)When FILE is'-',readstandard input. With no FILE,read'.'ifrecursive,'-'otherwise. With fewer than two FILEs, assume -h. Exit s...
To match blank lines, use the pattern ‘^[[:blank:]]*$’. 即,grep 命令认为每一行都包含空字符串,所以提供的匹配模式为空字符串时,会匹配到所有行。 匹配模式写为 '^'、'$'、'.*',也是会匹配到所有行。 如果想要匹配空行,匹配模式可以写为 '^$',空行只包含一个行末的换行符。 如果想要匹配只...
-s,--no-messages suppress error messages-v,--invert-match select non-matching lines-V,--version display version information and exit--help display this help text and exitOutput control: -m,--max-count=NUM stop after NUM matches-b,--byte-offset print the byte offset with output lines-n,...
matching substring must either be at the beginning of the line,orpreceded(在……之前) by anon-wordconstituent(成分) character. Similarly, it must be either at the end of the lineorfollowedby anon-wordconstituent character.Word-constituent(成分)characters areletters,digits, and theunderscore(下划线...
For example, grep -lZ outputs a zero byte after each file name instead of the usual newline. This option makes the output unambiguous, even in the presence of file names containing unusual characters like newlines. This option can be used with commands like find -print0, perl -0, sort -...
empty string as a group separator --color[=WHEN], --colour[=WHEN] use markers to highlight the matching strings; WHEN is 'always', 'never', or 'auto' -U, --binary do not strip CR characters at EOL (MSDOS/Windows) -u, --unix-byte-offsets report offsets ...
-m, --max-count=NUM stop after NUM matches -b, --byte-offset print the byte offset with output lines -n, --line-number print line number with output lines --line-buffered flush output on every line -H, --with-filename print thefilenameforeach match ...
matchPATTERNwill be skipped.-L,--files-without-match print only namesofFILEs containing no match-l,--files-with-matches print only namesofFILEs containing matches-c,--count print only a countofmatching lines perFILE-T,--initial-tab make tabs lineup(ifneeded)-Z,--nullprint0byte afterFILE...