> I would like do such a search and replace operation
> that goes into subdirectories,
> and replaces a block of text that spans many lines,
> and replace it with a string.
I use a perl one-liner combined with find, like this:
perl -pi -e s#text1#text2# `find . -name "*.php"`
This goes into each *.php file in every subdirectory under the current
dir, and replaces text1 with text2. You can replace *.php with *.html
or * obviously. If you need slashes in the substitution (e.g. to alter
a pathname in multiple html files), you need to mask with a backslash,
such as s#var#var\/log#
Oh, and I think (no guarantee though, try it) it also creates some
kind of .bak files so you have backups, just in case.