• Home
  • History
  • Annotate
  • Raw
  • Download

Lines Matching +full:- +full:b

35 <b>pcre2grep [options] [long options] [pattern] [path1 path2 ...]</b>
39 <b>pcre2grep</b> searches files for character patterns, in the same way as other
42 <a href="pcre2syntax.html"><b>pcre2syntax</b>(3)</a>
43 for a quick-reference summary of pattern syntax, or
44 <a href="pcre2pattern.html"><b>pcre2pattern</b>(3)</a>
62 pattern to be matched when neither <b>-e</b> nor <b>-f</b> is present.
64 arguments are treated as path names. At least one of <b>-e</b>, <b>-f</b>, or an
68 If no files are specified, <b>pcre2grep</b> reads the standard input. The
72 pcre2grep some-pattern file1 - file3
77 However, there are options that can change how <b>pcre2grep</b> behaves. In
78 particular, the <b>-M</b> option makes it possible to search for strings that
80 <b>-N</b> (<b>--newline</b>) option.
84 controlled by parameters that can be set by the <b>--buffer-size</b> and
85 <b>--max-buffer-size</b> options. The first of these sets the size of buffer
88 extending the buffer, up to the limit specified by <b>--max-buffer-size</b>. The
89 default values for these parameters can be set when <b>pcre2grep</b> is
101 BUFSIZ is defined in <b>&#60;stdio.h&#62;</b>. When there is more than one pattern
102 (specified by the use of <b>-e</b> and/or <b>-f</b>), each pattern is applied to
103 each line in the order in which they are defined, except that all the <b>-e</b>
104 patterns are tried before the <b>-f</b> patterns.
108 considered. However, if <b>--colour</b> (or <b>--color</b>) is used to colour the
109 matching substrings, or if <b>--only-matching</b>, <b>--file-offsets</b>, or
110 <b>--line-offsets</b> is used to output only the part of the line that matched
131 If the <b>LC_ALL</b> or <b>LC_CTYPE</b> environment variable is set,
132 <b>pcre2grep</b> uses the value to set a locale when calling the PCRE2 library.
133 The <b>--locale</b> option can be used to override this.
137 It is possible to compile <b>pcre2grep</b> so that it uses <b>libz</b> or
138 <b>libbz2</b> to read compressed files whose names end in <b>.gz</b> or
139 <b>.bz2</b>, respectively. You can find out whether your <b>pcre2grep</b> binary
141 <b>--help</b> option. If the appropriate support is not present, all files are
143 from a compressed .gz or .bz2 file, the <b>--line-buffered</b> option is
151 zero, the test for a binary file is not applied. See the <b>--binary-files</b>
158 from a file via the <b>-f</b> option may contain binary zeros.
163 example, both the <b>-H</b> and <b>-l</b> options affect the printing of file
170 <b>--</b>
176 <b>-A</b> <i>number</i>, <b>--after-context=</b><i>number</i>
181 context lines. A line containing "--" is output between each group of lines,
183 is expected to be relatively small. When <b>-c</b> is used, <b>-A</b> is ignored.
186 <b>-a</b>, <b>--text</b>
188 <b>--binary-files</b>=<i>text</i>.
191 <b>-B</b> <i>number</i>, <b>--before-context=</b><i>number</i>
196 instead of a colon for the context lines. A line containing "--" is output
199 <b>-c</b> is used, <b>-B</b> is ignored.
202 <b>--binary-files=</b><i>word</i>
206 which is equivalent to the <b>-a</b> or <b>--text</b> option, binary files are
209 sent to a terminal. If the word is "without-match", which is equivalent to the
210 <b>-I</b> option, binary files are not processed at all; they are assumed not to
215 <b>--buffer-size=</b><i>number</i>
218 <b>--max-buffer-size</b> below.
221 <b>-C</b> <i>number</i>, <b>--context=</b><i>number</i>
223 This is equivalent to setting both <b>-A</b> and <b>-B</b> to the same value.
226 <b>-c</b>, <b>--count</b>
229 <b>-v</b> is set, because they failed to match. By default, this count is
231 <b>-M</b> (multiline) option is used (without <b>-v</b>), there may be more
236 being scanned, a count is output for each of them and the <b>-t</b> option can
238 <b>--files-with-matches</b> option is also used, only those files whose counts
239 are greater than zero are listed. When <b>-c</b> is used, the <b>-A</b>,
240 <b>-B</b>, and <b>-C</b> options are ignored.
243 <b>--colour</b>, <b>--color</b>
244 If this option is given without any data, it is equivalent to "--colour=auto".
249 <b>--colour=</b><i>value</i>, <b>--color=</b><i>value</i>
255 because <b>pcre2grep</b> has to search for all possible matches in a line, not
262 <b>pcre2grep</b> looks for GREP_COLORS or GREP_COLOR (in that order). The value
265 followed by two semicolon-separated colours, terminated by the end of the
278 <b>-D</b> <i>action</i>, <b>--devices=</b><i>action</i>
284 <b>-d</b> <i>action</i>, <b>--directories=</b><i>action</i>
286 Valid values are "read" (the default in non-Windows environments, for
287 compatibility with GNU grep), "recurse" (equivalent to the <b>-r</b> option), or
291 end-of-file; in others it may provoke an error.
294 <b>--depth-limit</b>=<i>number</i>
295 See <b>--match-limit</b> below.
298 <b>-e</b> <i>pattern</i>, <b>--regex=</b><i>pattern</i>, <b>--regexp=</b><i>pattern</i>
301 single pattern that starts with a hyphen. When <b>-e</b> is used, no argument
307 If <b>-f</b> is used with <b>-e</b>, the command line patterns are matched first,
309 these options are specified. Note that multiple use of <b>-e</b> is not the same
312 separately, with X first, <b>pcre2grep</b> finds X if it is present, even if it
314 matters only if you are using <b>-o</b> or <b>--colo(u)r</b> to show the part(s)
318 <b>--exclude</b>=<i>pattern</i>
321 obtained from <b>--file-list</b>, or by scanning a directory. The pattern is a
323 file name, not the entire path. The <b>-F</b>, <b>-w</b>, and <b>-x</b> options do
325 to specify multiple patterns. If a file name matches both an <b>--include</b>
326 and an <b>--exclude</b> pattern, it is excluded. There is no short form for this
330 <b>--exclude-from=</b><i>filename</i>
331 Treat each non-empty line of the file as the data for an <b>--exclude</b>
333 system's default. The <b>--newline</b> option has no effect on this option. This
338 <b>--exclude-dir</b>=<i>pattern</i>
340 whatever the setting of the <b>--recursive</b> option. This applies to all
342 <b>--file-list</b>, or by scanning a parent directory. The pattern is a PCRE2
344 name, not the entire path. The <b>-F</b>, <b>-w</b>, and <b>-x</b> options do not
346 specify more than one pattern. If a directory matches both <b>--include-dir</b>
347 and <b>--exclude-dir</b>, it is excluded. There is no short form for this
351 <b>-F</b>, <b>--fixed-strings</b>
352 Interpret each data-matching pattern as a list of fixed strings, separated by
354 this purpose is controlled by the <b>--newline</b> option. The <b>-w</b> (match
355 as a word) and <b>-x</b> (match whole line) options can be used with <b>-F</b>.
357 strings are found in it (subject to <b>-w</b> or <b>-x</b>, if present). This
359 files; it does not apply to patterns specified by any of the <b>--include</b> or
360 <b>--exclude</b> options.
363 <b>-f</b> <i>filename</i>, <b>--file=</b><i>filename</i>
367 system's default interpretation of \n. The <b>--newline</b> option has no
373 description of <b>-e</b> above.
378 as "-" to refer to the standard input. When <b>-f</b> is used, patterns
379 specified on the command line using <b>-e</b> may also be present; they are
384 <b>--file-list</b>=<i>filename</i>
389 on the command line. The file name can be given as "-" to refer to the standard
390 input. If <b>--file</b> and <b>--file-list</b> are both specified as "-",
393 end-of-file indication. If this option is given more than once, all the
397 <b>--file-offsets</b>
400 mode, no context is shown. That is, the <b>-A</b>, <b>-B</b>, and <b>-C</b>
402 shown separately. This option is mutually exclusive with <b>--output</b>,
403 <b>--line-offsets</b>, and <b>--only-matching</b>.
406 <b>-H</b>, <b>--with-filename</b>
411 file name. When the <b>-M</b> option causes a pattern to match more than one
413 previous <b>-h</b>, <b>-l</b>, or <b>-L</b> options.
416 <b>-h</b>, <b>--no-filename</b>
421 overrides any previous <b>-H</b>, <b>-L</b>, or <b>-l</b> options.
424 <b>--heap-limit</b>=<i>number</i>
425 See <b>--match-limit</b> below.
428 <b>--help</b>
434 <b>-I</b>
436 <b>--binary-files</b>=<i>without-match</i>.
439 <b>-i</b>, <b>--ignore-case</b>
443 <b>--include</b>=<i>pattern</i>
444 If any <b>--include</b> patterns are specified, the only files that are
446 <b>--exclude</b> pattern. This option does not affect directories, but it
448 <b>--file-list</b>, or by scanning a directory. The pattern is a PCRE2 regular
450 the entire path. The <b>-F</b>, <b>-w</b>, and <b>-x</b> options do not apply to
452 matches both an <b>--include</b> and an <b>--exclude</b> pattern, it is excluded.
456 <b>--include-from=</b><i>filename</i>
457 Treat each non-empty line of the file as the data for an <b>--include</b>
459 default. The <b>--newline</b> option has no effect on this option. This option
463 <b>--include-dir</b>=<i>pattern</i>
464 If any <b>--include-dir</b> patterns are specified, the only directories that
466 an <b>--exclude-dir</b> pattern. This applies to all directories, whether listed
467 on the command line, obtained from <b>--file-list</b>, or by scanning a parent
469 the final component of the directory name, not the entire path. The <b>-F</b>,
470 <b>-w</b>, and <b>-x</b> options do not apply to this pattern. The option may be
471 given any number of times. If a directory matches both <b>--include-dir</b> and
472 <b>--exclude-dir</b>, it is excluded. There is no short form for this option.
475 <b>-L</b>, <b>--files-without-match</b>
478 output once, on a separate line. This option overrides any previous <b>-H</b>,
479 <b>-h</b>, or <b>-l</b> options.
482 <b>-l</b>, <b>--files-with-matches</b>
486 in a file. However, if the <b>-c</b> (count) option is also used, matching
489 <b>-c</b> is a way of suppressing the listing of files with no matches that
490 occurs with <b>-c</b> on its own. This option overrides any previous <b>-H</b>,
491 <b>-h</b>, or <b>-L</b> options.
494 <b>--label</b>=<i>name</i>
500 <b>--line-buffered</b>
501 When this option is given, non-compressed input is read and processed line by
503 large chunks, unless <b>pcre2grep</b> can determine that it is reading from a
504 terminal, which is currently possible only in Unix-like environments or
507 pipe and you do not want <b>pcre2grep</b> to buffer up large amounts of data.
508 However, its use will affect performance, and the <b>-M</b> (multiline) option
510 <b>--line-buffered</b> is ignored.
513 <b>--line-offsets</b>
516 number is terminated by a colon (as usual; see the <b>-n</b> option), and the
518 That is, the <b>-A</b>, <b>-B</b>, and <b>-C</b> options are ignored. If there is
520 mutually exclusive with <b>--output</b>, <b>--file-offsets</b>, and
521 <b>--only-matching</b>.
524 <b>--locale</b>=<i>locale-name</i>
526 the value in the <b>LC_ALL</b> or <b>LC_CTYPE</b> environment variables. If no
531 <b>-M</b>, <b>--multiline</b>
535 used with <b>-M</b> may usefully contain literal newline characters and internal
540 If <b>-v</b> is set, none of the lines in a multi-line match are output. Once a
550 pcre2grep -M 'regular\s+expression' &#60;file&#62;
554 well as possibly handling a two-character newline sequence.
558 that <b>pcre2grep</b> buffers the input file as it scans it. With a sufficiently
559 large processing buffer, this should not be a problem, but the <b>-M</b> option
560 does not work when input is read line by line (see <b>--line-buffered</b>.)
563 <b>-m</b> <i>number</i>, <b>--max-count</b>=<i>number</i>
564 Stop processing after finding <i>number</i> matching lines, or non-matching
565 lines if <b>-v</b> is also set. Any trailing context lines are output after the
569 If <b>-c</b> is also set, the count that is output is never greater than
570 <i>number</i>. This option has no effect if used with <b>-L</b>, <b>-l</b>, or
571 <b>-q</b>, or when just checking for a match in a binary file.
574 <b>--match-limit</b>=<i>number</i>
580 The <b>--match-limit</b> option provides a means of limiting computing resource
585 value set by <b>--match-limit</b> is reached, an error occurs.
588 The <b>--heap-limit</b> option specifies, as a number of kibibytes (units of
595 The <b>--depth-limit</b> option limits the depth of nested backtracking points,
600 set smaller than <b>--match-limit</b>.
608 <b>--max-buffer-size</b>=<i>number</i>
610 set by <b>--buffer-size</b>. The maximum buffer size is silently forced to be no
614 <b>-N</b> <i>newline-type</i>, <b>--newline</b>=<i>newline-type</i>
618 pcre2grep -N CRLF 'some pattern' &#60;file&#62;
622 types are the single-character sequences CR (carriage return) and LF
623 (linefeed), the two-character sequence CRLF, an "anycrlf" type, which
626 are the three just mentioned, plus VT (vertical tab, U+000B), FF (form feed,
631 When the PCRE2 library is built, a default line-ending sequence is specified.
633 otherwise specified by this option, <b>pcre2grep</b> uses the library's default.
636 This option makes it possible to use <b>pcre2grep</b> to scan files that have
639 option, <b>pcre2grep</b> may behave in strange ways. Note that this option does
640 not apply to files specified by the <b>-f</b>, <b>--exclude-from</b>, or
641 <b>--include-from</b> options, which are expected to use the operating system's
645 <b>-n</b>, <b>--line-number</b>
648 being output, it precedes the line number. When the <b>-M</b> option causes a
650 number. This option is forced if <b>--line-offsets</b> is used.
653 <b>--no-jit</b>
654 If the PCRE2 library is built with support for just-in-time compiling (which
655 speeds up matching), <b>pcre2grep</b> automatically makes use of this, unless it
661 <b>-O</b> <i>text</i>, <b>--output</b>=<i>text</i>
663 the text specified in this option, followed by an operating-system standard
664 newline. In this mode, no context is shown. That is, the <b>-A</b>, <b>-B</b>,
665 and <b>-C</b> options are ignored. The <b>--newline</b> option has no effect on
666 this option, which is mutually exclusive with <b>--only-matching</b>,
667 <b>--file-offsets</b>, and <b>--line-offsets</b>. However, like
668 <b>--only-matching</b>, if there is more than one match in a line, each of them
683 $a is replaced by bell; $b by backspace; $e by escape; $f by form feed; $n by
703 <b>-o</b>, <b>--only-matching</b>
705 line. In this mode, no context is shown. That is, the <b>-A</b>, <b>-B</b>, and
706 <b>-C</b> options are ignored. If there is more than one match in a line, each
707 of them is shown separately, on a separate line of output. If <b>-o</b> is
708 combined with <b>-v</b> (invert the sense of the match to find non-matching
712 otherwise empty line. This option is mutually exclusive with <b>--output</b>,
713 <b>--file-offsets</b> and <b>--line-offsets</b>.
716 <b>-o</b><i>number</i>, <b>--only-matching</b>=<i>number</i>
719 limit can be changed via the <b>--om-capture</b> option. A pattern may contain
721 limit can be accessed by <b>-o</b>. An error occurs if the number specified by
722 <b>-o</b> is greater than the limit.
725 -o0 is the same as <b>-o</b> without a number. Because these options can be
727 given in the same shell item, for example, -o3 or --only-matching=2. The
728 comments given for the non-argument case above also apply to this option. If
736 -o3 -o1 -o3 causes the substrings matched by capturing parentheses 3 and 1 and
741 <b>--om-capture</b>=<i>number</i>
742 Set the number of capturing parentheses that can be accessed by <b>-o</b>. The
746 <b>--om-separator</b>=<i>text</i>
747 Specify a separating string for multiple occurrences of <b>-o</b>. The default
751 <b>-q</b>, <b>--quiet</b>
756 <b>-r</b>, <b>--recursive</b>
758 taking note of any <b>--include</b> and <b>--exclude</b> settings. By default, a
760 immediate end-of-file. This option is a shorthand for setting the <b>-d</b>
764 <b>--recursion-limit</b>=<i>number</i>
765 This is an obsolete synonym for <b>--depth-limit</b>. See <b>--match-limit</b>
769 <b>-s</b>, <b>--no-messages</b>
770 Suppress error messages about non-existent or unreadable files. Such files are
775 <b>-t</b>, <b>--total-count</b>
777 <b>-t</b> suppresses all output except for a grand total number of matching
778 lines (or non-matching lines if <b>-v</b> is used) in all the files. If <b>-t</b>
779 is used with <b>-c</b>, a grand total is output except when the previous output
782 "TOTAL:". Otherwise, it appears as just another number. The <b>-t</b> option is
783 ignored when used with <b>-L</b> (list files without matches), because the grand
787 <b>-u</b>, <b>--utf</b>
788 Operate in UTF-8 mode. This option is available only if PCRE2 has been compiled
789 with UTF-8 support. All patterns (including those for any <b>--exclude</b> and
790 <b>--include</b> options) and all lines that are scanned must be valid strings
791 of UTF-8 characters. If an invalid UTF-8 string is encountered, an error
795 <b>-U</b>, <b>--utf-allow-invalid</b>
796 As <b>--utf</b>, but in addition subject lines may contain invalid UTF-8 code
798 themselves, however, must still be valid UTF-8 strings. This facility allows
799 valid UTF-8 strings to be sought within arbitrary byte sequences in executable
800 or other binary files. For more details about matching in non-valid UTF-8
802 <a href="pcre2unicode.html"><b>pcre2unicode</b>(3)</a>
806 <b>-V</b>, <b>--version</b>
807 Write the version numbers of <b>pcre2grep</b> and the PCRE2 library to the
812 <b>-v</b>, <b>--invert-match</b>
815 as <b>--only-matching</b> and <b>--output</b>, which specify parts of a match
819 <b>-w</b>, <b>--word-regex</b>, <b>--word-regexp</b>
822 having "\b(?:" at the start of each pattern, and ")\b" at the end. This
824 files; it does not apply to patterns specified by any of the <b>--include</b> or
825 <b>--exclude</b> options.
828 <b>-x</b>, <b>--line-regex</b>, <b>--line-regexp</b>
834 by any of the <b>--include</b> or <b>--exclude</b> options.
838 The environment variables <b>LC_ALL</b> and <b>LC_CTYPE</b> are examined, in that
840 by the <b>--locale</b> option. If no locale is set, the PCRE2 library's default
845 The <b>-N</b> (<b>--newline</b>) option allows <b>pcre2grep</b> to scan files with
848 specified by the <b>-f</b>, <b>--file-list</b>, <b>--exclude-from</b>, or
849 <b>--include-from</b> options.
860 The newline setting does not affect the way in which <b>pcre2grep</b> writes
870 Many of the short and long forms of <b>pcre2grep</b>'s options are the same
871 as in the GNU <b>grep</b> program. Any long option of the form
872 <b>--xxx-regexp</b> (GNU terminology) is also available as <b>--xxx-regex</b>
873 (PCRE2 terminology). However, the <b>--depth-limit</b>, <b>--file-list</b>,
874 <b>--file-offsets</b>, <b>--heap-limit</b>, <b>--include-dir</b>,
875 <b>--line-offsets</b>, <b>--locale</b>, <b>--match-limit</b>, <b>-M</b>,
876 <b>--multiline</b>, <b>-N</b>, <b>--newline</b>, <b>--om-separator</b>,
877 <b>--output</b>, <b>-u</b>, <b>--utf</b>, <b>-U</b>, and <b>--utf-allow-invalid</b>
878 options are specific to <b>pcre2grep</b>, as is the use of the
879 <b>--only-matching</b> option with a capturing parentheses number.
883 <b>pcre2grep</b>. For example, the <b>--include</b> option's argument is a glob
884 for GNU <b>grep</b>, but a regular expression for <b>pcre2grep</b>. If both the
885 <b>-c</b> and <b>-l</b> options are given, GNU grep lists only file names,
886 without counts, but <b>pcre2grep</b> gives the counts as well.
894 -f/some/file
895 -f /some/file
897 The exception is the <b>-o</b> option, which may appear with or without data.
899 item, for example -o3.
906 --file=/some/file
907 --file /some/file
915 The exceptions to the above are the <b>--colour</b> (or <b>--color</b>) and
916 <b>--only-matching</b> options, for which the data is optional. If one of these
918 character. Otherwise <b>pcre2grep</b> will assume that it has no data.
922 <b>pcre2grep</b> has, by default, support for calling external programs or
925 when <b>pcre2grep</b> is built. You can find out whether your binary has support
926 for callouts by running it with the <b>--help</b> option. If callout support is
927 completely disabled, all callouts in patterns are ignored by <b>pcre2grep</b>.
934 <a href="pcre2callout.html"><b>pcre2callout</b></a>
935 documentation for details). Numbered callouts are ignored by <b>pcre2grep</b>;
938 <br><b>
940 </b><br>
945 <b>pcre2grep</b> was built. The rest of the callout string is processed as a
946 zero-terminated string, which means it should not contain any internal binary
948 escape processing as text from the <b>--output</b> (<b>-O</b>) option (see
962 <br><b>
964 </b><br>
966 This facility can be independently disabled when <b>pcre2grep</b> is built. It
967 is supported for Windows, where a call to <b>_spawnvp()</b> is used, for VMS,
968 where <b>lib$spawn()</b> is used, and for any Unix-like environment where
969 <b>fork()</b> and <b>execv()</b> are available.
980 started by a dollar character. These are the same as for the <b>--output</b>
981 (<b>-O</b>) option documented above, except that $0 cannot insert the matched
986 echo -e "abcde\n12345" | pcre2grep \
988 (?C"/bin/echo|Arg1: [$1] [$2] [$3]|Arg2: $|${1}$| ($4)")()' -
998 are zero-terminated strings. This means that binary zero characters in the
1002 If running the program fails for any reason (including the non-existence of the
1012 in these circumstances. If this happens, <b>pcre2grep</b> outputs an error
1014 there are more than 20 such errors, <b>pcre2grep</b> gives up.
1017 The <b>--match-limit</b> option of <b>pcre2grep</b> can be used to set the
1019 memory used during matching; see the discussion of <b>--heap-limit</b> and
1020 <b>--depth-limit</b> above.
1025 for syntax errors, overlong lines, non-existent or inaccessible files (even if
1027 <b>-s</b> option to suppress error messages about inaccessible files does not
1036 <b>pcre2pattern</b>(3), <b>pcre2syntax</b>(3), <b>pcre2callout</b>(3),
1037 <b>pcre2unicode</b>(3).
1052 Copyright &copy; 1997-2020 University of Cambridge.