nimgrep User's manual

Author: Andreas Rumpf
Version: 0.9

Nimgrep is a command line tool for search&replace tasks. It can search for regex or peg patterns and can search whole directories at once. User confirmation for every single replace operation can be requested.

Nimgrep has particularly good support for Nim's eccentric style insensitivity. Apart from that it is a generic text manipulation tool.


Compile nimgrep with the command:

nim c -d:release tools/nimgrep.nim

And copy the executable somewhere in your $PATH.

Command line switches

nimgrep [options] [pattern] [replacement] (file/directory)*
--find, -ffind the pattern (default)
--replace, -rreplace the pattern
--pegpattern is a peg
--repattern is a regular expression (default); extended syntax for the regular expression is always turned on
--recursiveprocess directories recursively
--confirmconfirm each occurrence/replacement; there is a chance to abort any time without touching the file
--stdinread pattern from stdin (to avoid the shell's confusing quoting rules)
--word, -wthe match should have word boundaries (buggy for pegs!)
--ignoreCase, -ibe case insensitive
--ignoreStyle, -ybe style insensitive
--ext:EX1|EX2|...only search the files with the given extension(s)
--verbosebe verbose: list every processed file
--help, -hshows this help
--version, -vshows the version