Multiple Search/Replace Operations on Multiple Recursive Files: replace_string
Multiple Search/Replace Operations on Multiple Recursive Files
replace_string
requires Perl5 to be installed.
replace_string consistently changes/modifies any number of text files,
either interactively or in batch mode, either with or without keeping backups,
preserve modes/owner when run as root.
It enables you to do a dry-run in interactive mode
to see how your regular expressions will work, before you process all files in batch mode.
Features:
- do multiple search-replace or query-search-replace operations
- search-replace expressions can be given on the command line or read from a file
- processes multiple input files
- recursively descend into directory and do multiple search/replace operations on all files
- user defined perl expressions are applied to each line of each input file
- optionally run in paragraph mode (for multi-line search/replace)
- interactive mode
- batch mode
- optionally backup files and backup numbering
- preserve modes/owner when run as root
- ignore symbolic links, empty files, write protected files, sockets, named pipes, and directory names
- optionally replace lines only matching / not matching a given regular expression
The md5sum for revision 1.10 is 875f730ea7e8122d49a9e72a292a906c
License
replace_string is freely available under the terms of the OpenSource "Artistic License"
in combination with the Addendum A at the end of this page.
See Full License Text
Disclaimer
replace_string is a pretty powerful tool which gives you the freedom of applying any perl expressions
to every line in a number of files... and possibly destroying all your data if you are not careful..
so don't come to me wining, you have been warned.
BE EXTRA CAREFUL using it!!!
- make backups of your real data before you run replace_string
- try out your serach/replace operations on a small copy of your real data
- do a dry-run in query-mode (on a copy of your data!) before you process your real data!
- use version control software, such as CVS or RCS to keep old versions of your files!
- again+again: make backups of your valuable data!