Find & Replace String in Multiple Files

This section gives you some advices to succesfully search and replace strings in several files without harm. Indeed changing many files using a find and replace strategy, might lead to severe damages if your not a little cautious. Of course, it's likely you're working with a versionning system, but there are still some situations where you might quickly lose some contents, or corrupt files.

Searching for a given piece of text across thousand of files can easily be done whith a good find & replace utility software. However, here are a few things to think of to avoid corrupting your files:

  1. Whenever you replace some string, make sure that the expression matches all what you want to replace, and only what you want to replace.
  2. Do not open or write any file without an appropriate codec for processing the encoding of the file. Doing so would result in corrupting the file.
  3. Avoid modifying the style of end-of-lines.

To be continued...