Saturday, September 28, 2013

Search and Replace a string in set of files recursively in Linux/Mac using terminal

Hi,

I found this stackoverflow question/answer about searching set of files and replacing a string using terminal
http://stackoverflow.com/questions/9704020/recursive-search-and-replace-on-mac-and-linux

Here is the command I used to replace .com with .org in a .jade files I have in express.js application

find . -type f -name '*.ejs' -exec sed -i 's/.com/.org/g' {} +

Enjoy!