The UNIX sed program is kind of a nightmare to use. Part of that is intrinsic. However, part of the accidental complexity is that it doesn't handle applying a script to multiple files well…

Some time ago, I wrote a shell script to help with this. The script takes a list of files on the command line, and a sed script on standard input. It applies the sed script to each file in turn, being careful to save backup copies of the originals. It's probably not bulletproof, but I use it all the time.

Modern GNU sed does this for you. So you only need this if you happen to not have that.