Showing posts with label sed. Show all posts
Showing posts with label sed. Show all posts

Tuesday, June 9, 2009

Useful unix command to find and replace text in many files

Here is a useful unix command I used today to find and replace text across multiple files and multiple directories.

find . -type f -exec sed -i "s/string1/string2/g" {} \;

This will replace all instances of string1 with string2.

Credit to Google and http://www.sb.fsu.edu/~soma/Proj/How-to/Search+Replace.pdf for helping me figure this out.