ipgrep will unconditionally spawn a process for every file that is searched. Therefore, this can incur an unnecessarily large performance penalty if you don't otherwise need the flexibility offered by this flag. One possible mitigation to this is to use the \flag{pre-glob} flag to limit which files a preprocessor is run with. .PP A preprocessor is not run when ripgrep is searching stdin. .sp When searching over sets of files that may require one of several preprocessors, \fICOMMAND\fP should be a wrapper program which first classifies \fIPATH\fP based on magic numbers/content or based on the \fIPATH\fP name and then dispatches to an appropriate preprocessor. Each \fICOMMAND\fP also has its standard input connected to \fIPATH\fP for convenience. .sp For example, a shell script for \fICOMMAND\fP might look like: .sp .EX case "$1" in *.pdf) exec pdftotext "$1" - ;; *) case $(file "$1") in *Zstandard*) exec pzstd -cdq ;; *) exec cat ;; esac ;; esac .EE .sp The above script uses \fBpdftotext\fP to convert a PDF file to plain text. For all other files, the script uses the \fBfile\fP utility to sniff the type of the file based on its contents. If it is a compressed file in the Zstandard format, then \fBpzstd\fP is used to decompress the contents to stdout. .sp This overrides the \flag{search-zip} flag. pre-globInclude or exclude files from a preprocessor. This flag works in conjunction with the \flag{pre} flag. Namely, when one or more \flag{pre-glob} flags are given, then only files that match the given set of globs will be handed to the command specified by the \flag{pre} flag. Any non-matching files will be searched without using the preprocessor command. .sp This flag is useful when searching many files with the \flag{pre} flag. Namely, it provides the ability to avoid process overhead for files that don't need preprocessing. For example, given the following shell script, \fIpre-pdftotext\fP: .sp .EX #!/bin/sh pdftotext "$1" - .EE .sp then it is possible to use \fB\-\-pre\fP \fIpre-pdftotext\fP \fB--pre-glob '\fP\fI*.pdf\fP\fB'\fP to make it so ripgrep only executes the \fIpre-pdftotext\fP command on files with a \fI.pdf\fP extension. .sp Multiple \flag{pre-glob} flags may be used. Globbing rules match \fBgitignore\fP globs. Precede a glob with a \fB!\fP to exclude it. .sp This flag has no effect if the \flag{pre} flag is not used. prettyAlias for colors, headings and line numbers. This is a convenience alias for \fB\-\-color=always \-\-heading \-\-line\-number\fP. This flag is useful when you still want pretty output even if you're piping ripgrep to another program or file. For example: \fBrg -p \fP\fIfoo\fP \fB| less -R\fP. quietDo not print anything to stdout. Do not print anything to stdout. If a match is found in a file, then ripgrep will stop searching. This is useful when ripgrep is used only for its exit code (which will be an error code if no matches are found). .sp When \flag{files} is used, ripgrep will stop finding files after finding the first file that does not match any ignore rules. regex-size-limitThe size limit of the compiled regex. The size limit of the compiled regex, where the compiled regex generally corresponds to a single object in memory that can match all of the patterns provided to ripgrep. The default limit is generous enough that most reasonable patterns (or even a small number of them) should fit. .sp This useful to change when you explicitly want to let ripgrep spend potentially much more time and/or memory building a regex matcher. .sp The input format accepts suffixes of \fBK\fP, \fBM\fP or \fBG\fP which correspond to kilobytes, megabytes and gigabytes, respectively. If no suffix is provided the input is treated as bytes. regexpPATTERNA pattern to search for. A pattern to search for. This option can be provided multiple times, where all patterns given are searched, in addition to any patterns provided by \flag{file}. Lines matching at least one of the provided patterns are printed. This flag can also be used when searching for patterns that start with a dash. .sp For example, to search for the literal \fB\-foo\fP: .sp .EX rg \-e \-foo .EE .sp You can also use the special \fB\-\-\fP delimiter to indicate that no more flags will be provided. Namely, the following is equivalent to the above: .sp .EX rg \-\- \-foo .EE .sp When \flag{file} or \flag{regexp} is used, then ripgrep treats all positional arguments as files or directories to search. replaceREPLACEMENTReplace matches with the given text. Replaces every match with the text given when printing results. Neither this flag nor any other ripgrep flag will modify your files. .sp Capture group indices (e.g., \fB$\fP\fI5\fP) and names (e.g., \fB$\fP\fIfoo\fP) are supported in the replacement string. Capture group indices are numbered based on the position of the opening parenthesis of the group, where the leftmost such group is \fB$\fP\fI1\fP. The special \fB$\fP\fI0\fP group corresponds to the entire match. .sp The name of a group is formed by taking the longest string of letters, numbers and underscores (i.e. \fB[_0-9A-Za-z]\fP) after the \fB$\fP. For example, \fB$\fP\fI1a\fP will be replaced with the group named \fI1a\fP, not the group at index \fI1\fP. If the group's name contains characters that aren't letters, numbers or underscores, or you want to immediately follow the group with another string, the name should be put inside braces. For example, \fB${\fP\fI1\fP\fB}\fP\fIa\fP will take the content of the group at index \fI1\fP and append \fIa\fP to the end of it. .sp If an index or name does not refer to a valid capture group, it will be replaced with an empty string. .sp In shells such as Bash and zsh, you should wrap the pattern in single quotes instead of double quotes. Otherwise, capture group indices will be replaced by expanded shell variables which will most likely be empty. .sp To write a literal \fB$\fP, use \fB$$\fP. .sp Note that the replacement by default replaces each match, and not the entire line. To replace the entire line, you should match the entire line. .sp This flag can be used with the \flag{only-matching} flag. search-zipno-search-zipSearch in compressed files. This flag instructs ripgrep to search in compressed files. Currently gzip, bzip2, xz, LZ4, LZMA, Brotli and Zstd files are supported. This option expects the decompression binaries (such as \fBgzip\fP) to be available in your \fBPATH\fP. If the required binaries are not found, then ripgrep will not emit an error messages by default. Use the \flag{debug} flag to see more information. .sp Note that this flag does not make ripgrep search archive formats as directory trees. It only makes ripgrep detect compressed files and then decompress them before searching their contents as it would any other file. .sp This overrides the \flag{pre} flag. smart-caseSmart case search. This flag instructs ripgrep to searches case insensitively if the pattern is all lowercase. Otherwise, ripgrep will search case sensitively. .sp A pattern is considered all lowercase if both of the following rules hold: .sp .IP \(bu 3n First, the pattern contains at least one literal character. For example, \fBa\\w\fP contains a literal (\fBa\fP) but just \fB\\w\fP does not. .sp .IP \(bu 3n Second, of the literals in the pattern, none of them are considered to be uppercase according to Unicode. For example, \fBfoo\\pL\fP has no uppercase literals but \fBFoo\\pL\fP does. .PP This overrides the \flag{case-sensitive} and \flag{ignore-case} flags. sort-filesno-sort-files(DEPRECATED) Sort results by file path. DEPRECATED. Use \fB\-\-sort=path\fP instead. .sp This flag instructs ripgrep to sort search results by file path lexicographically in ascending order. Note that this currently disables all parallelism and runs search in a single thread. .sp This flag overrides \flag{sort} and \flag{sortr}. sortSORTBYSort results in ascending order. This flag enables sorting of results in ascending order. The possible values for this flag are: .sp .TP 12 \fBnone\fP (Default) Do not sort results. Fastest. Can be multi-threaded. .TP 12 \fBpath\fP Sort by file path. Always single-threaded. The order is determined by sorting files in each directory entry during traversal. This means that given the files \fBa/b\fP and \fBa+\fP, the latter will sort after the former even though \fB+\fP would normally sort before \fB/\fP. .TP 12 \fBmodified\fP Sort by the last modified time on a file. Always single-threaded. .TP 12 \fBaccessed\fP Sort by the last accessed time on a file. Always single-threaded. .TP 12 \fBcreated\fP Sort by the creation time on a file. Always single-threaded. .PP If the chosen (manually or by-default) sorting criteria isn't available on your system (for example, creation time is not available on ext4 file systems), then ripgrep will attempt to detect this, print an error and exit without searching. .sp To sort results in reverse or descending order, use the \flag{sortr} flag. Also, this flag overrides \flag{sortr}. .sp Note that sorting results currently always forces ripgrep to abandon parallelism and run in a single thread. nonepathmodifiedaccessedcreated