.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. .TH NIMGREP "1" "April 2024" "nimgrep 1.6.14-2" "User Commands" .SH NAME nimgrep \- Nimgrep .SH DESCRIPTION nimgrep \- Nim Grep Searching and Replacement Utility Version 1.6.0 .IP (c) 2012\-2020 Andreas Rumpf .PP Usage: .SS "* To search::" .IP nimgrep [options] PATTERN [(FILE/DIRECTORY)*/\-] .SS "* To replace::" .IP nimgrep [options] PATTERN \fB\-\-replace\fR REPLACEMENT (FILE/DIRECTORY)*/\- .SS "* To list file names::" .IP nimgrep [options] \fB\-\-filenames\fR [PATTERN] [(FILE/DIRECTORY)*] .PP Positional arguments, from left to right: 1) PATTERN is either Regex (default) or Peg if `\-\-peg` is specified. .IP PATTERN and REPLACEMENT should be skipped when `\-\-stdin` is specified. .PP 2) REPLACEMENT supports `$1`, `$#` notations for captured groups in PATTERN. .IP \&.. DANGER:: `\-\-replace` mode **DOES NOT** ask confirmation .IP unless `\-\-confirm` is specified! .PP 3) Final arguments are a list of paths (FILE/DIRECTORY) or a standalone .IP minus `\-` or not specified (empty): .IP * empty, current directory `.` is assumed (not with `\-\-replace`) .IP \&.. Note:: so when no FILE/DIRECTORY/`\-` is specified nimgrep .IP does **not** read the pipe, but searches files in the current dir instead! .IP * `\-`, read buffer once from stdin: pipe or terminal input; .IP in `\-\-replace` mode the result is directed to stdout; it's not compatible with `\-\-stdin`, `\-\-filenames`, or `\-\-confirm` .IP For any given DIRECTORY nimgrep searches only its immediate files without traversing sub\-directories unless `\-\-recursive` is specified. .PP In replacement mode we require all 3 positional arguments to avoid damaging. .SH OPTIONS .SS "* Mode of operation:" .TP \fB\-\-find\fR, \fB\-f\fR find the PATTERN (default) .TP \fB\-\-replace\fR, \-! replace the PATTERN to REPLACEMENT, rewriting the files .TP \fB\-\-confirm\fR confirm each occurrence/replacement; there is a chance to abort any time without touching the file .TP \fB\-\-filenames\fR just list filenames. Provide a PATTERN to find it in the filenames (not in the contents of a file) or run with empty pattern to just list all files:: .TP nimgrep \fB\-\-filenames\fR # In current dir .TP nimgrep \fB\-\-filenames\fR "" DIRECTORY # Note empty pattern "", lists all files in DIRECTORY .SS "* Interprete patterns:" .TP \fB\-\-peg\fR PATTERN and PAT are Peg .TP \fB\-\-re\fR PATTERN and PAT are regular expressions (default) .TP \fB\-\-rex\fR, \fB\-x\fR use the "extended" syntax for the regular expression so that whitespace is not significant .TP \fB\-\-word\fR, \fB\-w\fR matches should have word boundaries (buggy for pegs!) .TP \fB\-\-ignoreCase\fR, \fB\-i\fR be case insensitive in PATTERN and PAT .TP \fB\-\-ignoreStyle\fR, \fB\-y\fR be style insensitive in PATTERN and PAT .IP \&.. Note:: PATERN and patterns PAT (see below in other options) are all either .IP Regex or Peg simultaneously and options `\-\-rex`, `\-\-word`, `\-\-ignoreCase`, and `\-\-ignoreStyle` are applied to all of them. .SS "* File system walk:" .TP \fB\-\-recursive\fR, \fB\-r\fR process directories recursively .TP \fB\-\-follow\fR follow all symlinks when processing recursively .TP \fB\-\-ext\fR:EX1|EX2|... only search the files with the given extension(s), empty one ("\-\-ext") means files with missing extension .TP \fB\-\-noExt\fR:EX1|... exclude files having given extension(s), use empty one to skip files with no extension (like some binary files are) .TP \fB\-\-includeFile\fR:PAT search only files whose names contain pattern PAT .TP \fB\-\-excludeFile\fR:PAT skip files whose names contain pattern PAT .TP \fB\-\-includeDir\fR:PAT search only files with their whole directory path containing PAT .TP \fB\-\-excludeDir\fR:PAT skip directories whose name (not path) contain pattern PAT .TP \fB\-\-if\fR,\-\-ef,\-\-id,\-\-ed abbreviations of the 4 options above .TP \fB\-\-sortTime\fR, \fB\-s[\fR:asc|desc] order files by the last modification time (default: off): ascending (recent files go last) or descending .SS "* Filter file content:" .TP \fB\-\-match\fR:PAT select files containing a (not displayed) match of PAT .TP \fB\-\-noMatch\fR:PAT select files not containing any match of PAT .TP \fB\-\-bin\fR:on|off|only process binary files? (detected by \e0 in first 1K bytes) (default: on \- binary and text files treated the same way) .TP \fB\-\-text\fR, \fB\-t\fR process only text files, the same as `\-\-bin:off` .SS "* Represent results:" .TP \fB\-\-nocolor\fR output will be given without any colors .TP \fB\-\-color[\fR:on] force color even if output is redirected (default: auto) .TP \fB\-\-colorTheme\fR:THEME select color THEME from `simple` (default), `bnw` (black and white), `ack`, or `gnu` (GNU grep) .TP \fB\-\-count\fR only print counts of matches for files that matched .TP \fB\-\-context\fR:N, \fB\-c\fR:N print N lines of leading context before every match and N lines of trailing context after it (default N: 0) .TP \fB\-\-afterContext\fR:N, \fB\-a\fR:N print N lines of trailing context after every match .TP \fB\-\-beforeContext\fR:N, \fB\-b\fR:N print N lines of leading context before every match .TP \fB\-\-group\fR, \fB\-g\fR group matches by file .TP \fB\-\-newLine\fR, \fB\-l\fR display every matching line starting from a new line .TP \fB\-\-cols[\fR:N] limit max displayed columns/width of output lines from files by N characters, cropping overflows (default: off) .TP \fB\-\-cols\fR:auto, \-% calculate columns from terminal width for every line .TP \fB\-\-onlyAscii\fR, \-@ display only printable ASCII Latin characters 0x20\-0x7E substitutions: 0 \-> ^@, 1 \-> ^A, ... 0x1F \-> ^_, .IP 0x7F \-> '7F, ..., 0xFF \-> 'FF .SS "* Miscellaneous:" .TP \fB\-\-threads\fR:N, \fB\-j\fR:N speed up search by N additional workers (default: 0, off) .TP \fB\-\-stdin\fR read PATTERN from stdin (to avoid the shell's confusing quoting rules) and, if `\-\-replace` given, REPLACEMENT .TP \fB\-\-verbose\fR be verbose: list every processed file .TP \fB\-\-help\fR, \fB\-h\fR shows this help .TP \fB\-\-version\fR, \fB\-v\fR shows the version .SH "REPORTING BUGS" https://github.com/nim-lang/Nim/issues .SH "SEE ALSO" The nim-doc package.