|
SuperReplace is a program that I wrote using the language Perl. Super replace can find and replace a word in a single file or files in an entire directory. It also sports a scripting facility that you can use to setup multiple replacements. Documentation
Usage: superreplace [OPTIONS]
--in File|Dir Input File (or Dir to recurse)
--out File|Dir Output File (or Dir)
--o Overwrite input
--find Word Word to find
--replace Word Word to replace with
--s ScriptFile Script Mode
To simply find a word and replace it in a file you would type: superreplace --in filename --find word --replace word
If you however wanted to leave the original file intact and have a copy with the replacements then you could do: superreplace --in filename --out filename --find word --replace word
You can specify a directory instead of a file, in that case the directory will be recursed, all of its files and all of the files in it's sub-directories etc. etc. will be processed. Similarly if you want to leave the original files intact you can specify and output directory. If you want to replace more than one word then you can use a scriptfile instead: superreplace --in filename --s scriptfilename
The scriptfile is just a simple textfile with the format: word1tofind -> replacewith word2tofind -> replacewith The space before and after the 'arrow' are required. If you prefix a line with # it will be treated as a comment. |