Search and Replace in Multiple Files

  • January, 05 2007
  • triplem
  • Linux

Today I learned how to search and replace in multiple files. It is pretty easy. You can lookup how it works on the page for Debian Administrators. Basically you have to use a perl single line command like:

perl -pi -e 's/about news\.$/about selling advertising space\./' file*

This will edit each file directly on its place and will search for the string about news. and will replace it with about selling advertising space. You are done 🙂

Search

    confused thoughts from a confused mind