#!/bin/sh
old=\"hello\"
new=\"world\"
sed -i s/\"${old}\"/\"${new}\"/g $(grep \"${old}\" -rl *)
The preceding script just work for single line text
awk
can do that for you.
awk 'BEGIN { RS="" }
FILENAME==ARGV[1] { s=$0 }
FILENAME==ARGV[2] { r=$0 }
FILENAME==ARGV[3] { sub(s,r) ; print }
' FILE_WITH_CONTENTS_OF_OLD FILE_WITH_CONTENTS_OF_NEW ORIGINALFILE > NEWFILE
But you can do it with vim
like described here (scriptable solution).
Also see this and this in the sed faq.