PCRE2GREP(1) General Commands Manual PCRE2GREP(1) (NAME) pcre2grep - (SYNOPSIS) pcre2grep [] [ ] [] [ ...] (DESCRIPTION) pcre2grep grep () PCRE2 (Perl 5) . pcre2syntax(3) PCRE2 pcre2pattern(3) . (delimiters) . : pcre2grep Thursday /etc/motd ( ) . () () (shell metacharacters) . -e -f . . -e -f . pcre2grep . . : pcre2grep some-pattern file1 - file3 (^ $ \A \Z \z) . (:) . pcre2grep . -M . -N (--newline) . -h -H -Z . --buffer-size --max-buffer-size . . --max-buffer-size . pcre2grep 20KiB 1MiB . . << >> <<>> <<>> . . . 8KiB BUFSIZ ( ) . BUFSIZ . ( -e / -f ) -e -f . . --colour ( --color) --only-matching --file-offsets --line-offsets --output ( /) . . . . . 10.41 GNU grep . pcre2grep . . "(super)?(man)?" . "super" "man" "super|man" . LC_ALL LC_CTYPE pcre2grep PCRE2 (locale) . --locale . (SUPPORT FOR COMPRESSED FILES) pcre2grep libz libbz2 .gz .bz2 . --help pcre2grep . . . .gz .bz2 . .gz .bz2 --line-buffered . (BINARY FILES) () . NUL ( ) . --binary-files . (BINARY ZEROS IN PATTERNS) . -f . (OPTIONS) . -H -l . . . K M * . -- . . . -A number, --after-context=number number . . / ( -Z ). "--" . number . -c -A . -a, --text . --binary-files=text . --allow-lookaround-bsk PCRE2 \K (lookarounds) . pcre2grep PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK . -B number, --before-context=number number . number . / ( -Z ). "--" . number . -c -B . --binary-files=word . "binary" ( ) "Binary file matches" . "text" -a --text . . "without-match" -I . --buffer-size=number . --max-buffer-size . -C number, --context=number number . -A -B . -c, --count -v . -M () ( -v) ( ). . -t . --files-with-matches . -c -A -B -C . --colour, --color "--colour=auto" . . --colour=value, --color=value . --file-offsets --line-offsets --output . . --colour ( ) "never" "always" "auto" . . pcre2grep . PCRE2GREP_COLOUR PCRE2GREP_COLOR PCREGREP_COLOUR PCREGREP_COLOR ( ) . pcre2grep GREP_COLORS GREP_COLOR ( ) . GREP_COLORS "ms=" "mt=" . GREP_COLORS "ms=" "mt=" GREP_COLOR . . . "1;31" . -D action, --devices=action "action" . "read" () "skip" ( ). -d action, --directories=action "action" . "read" ( GNU grep) "recurse" ( -r) "skip" ( ). "read" . --depth-limit=number --match-limit . -E, --case-restrict (K S) U+212A ( ) U+017F (S ) . . -e pattern, --regex=pattern, --regexp=pattern . . . -e . . . -f -e () . --exclude=pattern ( ) . --file-list . PCRE2 . -F -w -x . . --include --exclude . . --exclude-from=filename --exclude . . --newline . . --exclude-dir=pattern --recursive . --file-list . PCRE2 . -F -w -x . . --include-dir --exclude-dir . . -F, --fixed-strings . --newline . -w ( ) -x ( ) -F . . ( -w -x ). --include --exclude . -f filename, --file=filename . . \n . --newline . --posix-pattern-file . . . . . "-" . -f -e . . --file-list=filename / . . . . "-" . --file --file-list "-" . ( ) . . --file-offsets () . --colour . -A -B -C . . --output --line-offsets --only-matching . --group-separator=text -A -B -C . --no-group-separator . -H, --with-filename . . . -Z . . -M . -h -l -L . -h, --no-filename . . . -Z . . -H -L -l . --heap-limit=number --match-limit . --help . . -I . --binary-files=without-match . -i, --ignore-case . . --include=pattern --include --exclude . --file-list . PCRE2 . -F -w -x . . --include --exclude . . --include-from=filename --include . . --newline . . --include-dir=pattern --include-dir --exclude-dir . --file-list . PCRE2 . -F -w -x . . --include-dir --exclude-dir . . -L, --files-without-match . -Z . -H -h -l . -l, --files-with-matches . -Z . . -c () . -c -c . -H -h -L . --label=name . "(standard input)" . . --line-buffered () . pcre2grep . . pcre2grep . -M () . .gz .bz2 --line-buffered . --line-offsets . ( -n ) . --colour -A -B -C . . --output --file-offsets --only-matching . --locale=locale-name (locale) . LC_ALL LC_CTYPE . PCRE2 ( "C") . . -M, --multiline . PCRE2 <<>> . -M ^ $ . pcre2grep \Z \z . \A . . . . . -v . . . "regular expression" "regular" "expression" : pcre2grep -M 'regular\s+expression' \s + . pcre2grep . . -M ( --line-buffered ). -m number, --max-count=number number ( -v ) . . . . -c number . -L -l -q . --match-limit=number . . . --match-limit . . PCRE2 . --match-limit . --heap-limit ( ) . --depth-limit (backtracking) . . --match-limit . . PCRE2 . --max-buffer-size=number --buffer-size . . -N newline-type, --newline=newline-type . : pcre2grep -N CRLF 'some pattern' . NUL . CR ( ) LF ( ) CRLF "anycrlf" "any" . VT ( U+000B) FF ( U+000C) NEL ( U+0085) LS ( U+2028) PS ( U+2029) . PCRE2 . . pcre2grep . pcre2grep . pcre2grep . -f --exclude-from --include-from . -n, --line-number . . -M . --line-offsets . --no-group-separator -A -B -C . . --group-separator . --no-jit PCRE2 (Just-in-Time - JIT ) pcre2grep . JIT . . -O text, --output=text . --colour -A -B -C . --newline --only-matching --file-offsets --line-offsets . --only-matching . ($) / . $ {}$ &$ ( $0 ) . . a$ (bell) b$ (backspace) e$ (escape) f$ (form feed) n$ (newline) r$ (carriage return) t$ (tab) v$ (vertical tab) . o$ o{}$ () . . . x$ x{}$ () . . . . $$ . -o, --only-matching . . -A -B -C . . -o -v ( ) . . --output --file-offsets --line-offsets . -onumber, --only-matching=number . . --om-capture . -o . -o . o0- -o . ( ) o3- only-matching=2--. . . . o3 -o1 -o3- . ( ). --om-capture=number -o . . --om-separator=text -o . . . -P, --no-ucp 10.43 UTF/ -u -U PCRE2_UCP . POSIX . [:digit:] . --no-ucp PCRE2_UCP POSIX . . UCP (?aP) [:word:] \w . --posix-pattern-file -f grep . CRLF ( ) '\r' . -q, --quiet . . -r, --recursive --include --exclude . . -d "recurse" . --recursion-limit=number --depth-limit . --match-limit . -s, --no-messages . . . -t, --total-count . -t ( -v) . -t -c . . ":TOTAL" . . -t -L ( ) . -u, --utf UTF/ . PCRE2 UTF-8 . ( --exclude --include) UTF-8 . UTF-8 . -U, --utf-allow-invalid --utf UTF-8 . . UTF-8 . UTF-8 . UTF-8 pcre2unicode(3) . -V, --version pcre2grep PCRE2 . . -v, --invert-match . --only-matching --output . -w, --word-regex, --word-regexp "" . "\b(?:" ")\b" . --include --exclude . -x, --line-regex, --line-regexp . . "^(?:" ")$" . --include --exclude . -Z, --null ( NUL) . . . (ENVIRONMENT VARIABLES) LC_ALL LC_CTYPE (locale) . . --locale . PCRE2 ( "C") . (NEWLINES) -N (--newline) pcre2grep . . -f --file-list --exclude-from --include-from . . . CR LF CRLF NUL (ANYCRLF ANY) NL . pcre2grep . "\r\n" / C "\r\r\n" . "\r\n" . "\n" . GNU GREP (OPTIONS COMPATIBILITY WITH GNU GREP) pcre2grep GNU grep . --xxx-regexp ( GNU) --xxx-regex ( PCRE2) . --case-restrict --depth-limit -E --file-list --file-offsets --heap-limit --include-dir --line-offsets --locale --match-limit -M --multiline -N --newline --no-ucp --om-separator --output -P -u --utf -U --utf-allow-invalid pcre2grep --only-matching . pcre2grep . --include GNU grep (glob) pcre2grep -i . -c -l GNU grep pcre2grep . (OPTIONS WITH DATA) . ( ) . : -f/some/file -f /some/file -o . o3-. ( ) . : --file=/some/file --file /some/file ~ ~ ~ . --colour ( --color) --only-matching . . pcre2grep . PCRE2 (USING PCRE2'S CALLOUT FACILITY) pcre2grep (callout) PCRE2 . pcre2grep . --help . pcre2grep . . PCRE2 (?C) ( pcre2callout ). pcre2grep . (Echoing a specific string) (|) . pcre2grep . . --output (-O) ( ) . $0 &$ '0' . ( ) . n$ . : pcre2grep '(.)(..(.))(?C"|[$1] [$2] [$3]$n")' . (*FAIL) . (Calling external programs or scripts) pcre2grep . ( _spawnvp() ) VMS ( lib$spawn() ) fork() execv() . (|) . : executable_name|arg1|arg2|... ( ) . --output (-O) $0 &$ . '0' . $$ |$ . : echo -e "abcde\n12345" | pcre2grep \ '(?x)(.)(..(.)) (?C"/bin/echo|Arg1: [$1] [$2] [$3]|Arg2: $|${1}$| ($4)")()' - : Arg1: [a] [bcd] [d] Arg2: |a| () abcde Arg1: [1] [234] [4] Arg2: |1| () 12345 . . ( ) . ( ) . (MATCHING ERRORS) . : (a+)*\d a . PCRE2 . pcre2grep . pcre2grep . --match-limit pcre2grep . --heap-limit --depth-limit . (EXIT CODES) ( ) . -s . VMS PCRE2GREP_RC VMS exit(0) exit(1) . (SEE ALSO) pcre2pattern(3), pcre2syntax(3), pcre2callout(3), pcre2unicode(3). (AUTHOR) Philip Hazel Retired from University Computing Service Cambridge, England. (REVISION) Last updated: 24 January 2025 Copyright (c) 1997-2023 University of Cambridge. PCRE2 10.48 24 January 2025 PCRE2GREP(1)