title: unix find and replace text in dir and subdirs
body: <p>I'm trying to change the name of "my-silly-home-page-name.html" to "index.html" in all documents within a given master directory and subdirs.  </p>
  
  <p>I saw this: <a href="https://stackoverflow.com/questions/648862/shell-script-search-and-replace-text-in-multiple-files-using-a-list-of-strings">Shell script - search and replace text in multiple files using a list of strings</a>.  </p>
  
  <p>And this: <a href="https://stackoverflow.com/questions/8905662/how-to-change-all-occurances-of-a-word-in-all-files-in-a-directory/">How to change all occurrences of a word in all files in a directory</a></p>
  
  <p>I have tried this:</p>
  
  <pre><code>grep -r "my-silly-home-page-name.html" .
  </code></pre>
  
  <p>This finds the lines on which the text exists, but now I would like to substitute 'my-silly-home-page-name' for 'index'.
  How would I do this with sed or perl?
  Or do I even need sed/perl?</p>
  
  <p>Something like:</p>
  
  <pre><code>grep -r "my-silly-home-page-name.html" . | sed 's/$1/'index'/g'
  </code></pre>
  
  <p>?</p>
  
  <p>Also; I am trying this with perl, and I try the following:</p>
  
  <pre><code>perl -i -p -e 's/my-silly-home-page-name\.html/index\.html/g' *
  </code></pre>
  
  <p>This works, but I get an error when perl encounters directories, saying "Can't do inplace edit: SOMEDIR-NAME is not a regular file, &lt;> line N"</p>
  
  <p>Thanks,
  jml</p>