Windows Command Line find and replace-made easy with fart.exe here is a great little application that does a find and replace on a particle file, file type or file contents, then replaces it with a string of your choice. it can look in sub directories as well.
The small app is called fart, yes that's right fart-find and replace text!
Usage: fart [Options] [--][,...] [Find_string] [replace_string]
Options
- -H,-help show this help message (ignores other options)
- -Q,-Quiet suppress output to stdio/stderr
- -V,-verbose show more information
- -R,-recursive process Sub-folders recursively
- -C,-count only show filenames, match counts and totals
- -I,-ignore-case insensitive text comparison
- -V,-invert print lines not containing the find string
- -N,-line-Number Print line number before each line (1-based)
- -W,-word match Whole word (uses C syntax, like grep)
- -F,-filename find (and replace) filename instead of contents
- -B,-binary also search (and replace) in binary files (caution)
- -C,-C-style allow C-style extended characters (\ xFF \ t \ n \ r \ etc .)
- -CVS skip CVS dirs; execute "CVS edit" before changing files
- -SVN skip SVN dirs
- -Remove remove all occurences of the find_string
- -A,-adapt the case of replace_string to found string
- -B,-Backup make a backup of each changed File
- -P,-preview do not change the files but print the changes
Example 1(Replace text, preview only)
Fart-c-r-I-p *. txt original_text new_text
This will look for all. txt files in a sub directory, locateOriginal_textString within the. txt file and change itNew_text. The-P switch means it won't actually change anything because this is a preview, showing you how to adjust strings it found within each. txt file.
Example 2(Replace text)
Fart-c-r-I *. txt original_text new_text
Same as above should t it will do the actual replacement.
Example 3(Remove text)
Fart-r-I -- remove *. txt "remove this text"
Rather than replacing one term for another this will remove the specified term.
Note: use quotes around text if it contains spaces, tabs, etc.
Download fart from SourceForge.