Replace text in files
Project description
Replace text in files.
Requirements
Python 2.7 or Python 3.
Install
Install with pip as usual.
Screenshot
Basic usage
replacer [OPTIONS] PATTERN REPLACEMENT [FILES ...]
Note that internally, we’ll call Python with:
re.sub(<PATTERN>, <REPLACEMENT>, line)
for each line of every regular file found in the current working directory.
This means you can use fancy backward references with 1
By default hidden files, and files matching build-*, .git, .svn, *.py[co], *.[oa] , *.back, *~ , *.so, *.a will be ignored
If FILES is given, replacement will be performed on the files given as argument.
You can also specify --file-filter to specify a pattern to match against the filenames. For instance, to replace in every .c file, use:
replacer spam eggs --file-filter '*.c'
You can create a backup for each modified file by using --backup
Advanced usage
See
replacer --help
for a full list of options
History
First version was implemented in Perl/Bash in ctafconf
Then it was rewritten in Python in this commit
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for replacer-1.0.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d63234d2752e40f84f9a1b9fd57df7ba3a5573058eb605a16c877ce9ce8e9800 |
|
MD5 | ac1f4fceb381f0d118e928b65b4e5ec9 |
|
BLAKE2b-256 | 474abee761cdd7523e611fa777921a94efafa54f7df91d9885d7cdf6f5847c42 |