Script for search and replace
Description:
Last updated: February, 2010
download: source(shell script)
A script to search and replace through file patterns in a subdirectory. The script takes as input [old pattern] [new patter] [list of file patterns (e.g. *.py *.txt)]. It uses vi to do the search and replace in all the files that it finds.
The following Example, shows how search and replace can be used. The script has 3 stages. Stage one search and replaces all days with capital letters with small caps. Stage two checks if the search and replace was successful (the search should not result in any files). Finally stage three renames all files to files with an xml extension.