Request for comments: Search and replace script

VanL vlindberg at
Fri Feb 22 21:50:10 CET 2002


I recently finished writing a search and replace script to automate some 
of the things I do at work. It does the following:

Will search and replace in a single file, all files in a directory, or 
Will search and replace from a regular expression or a string
Excludes all binary files unless --binary argument is given
Has include and exclude lists (search and replace in all *.html, but
exclude donttouch.html)

and a bunch of other stuff too. Most of the work is encapsulated in
some fairly reusable classes.

You can find it at

I would be very appreciative of any comments or patches to it.
Particularly, I am interested in:

- Things that could make it faster
- Things to make it more 'pythonic'
- Bugs or logic errors

After any suggested improvements have been made, I will be submitting it
to useless python, in the hope that it may be more generally useful.

Tear into it,


More information about the Python-list mailing list