03/03/2010

Replace string occurrences recursively

I am so proud of my first post :) . I know that is not such a very big and interesting contribute (also because you can find it just googling) but let's say that I have a very bad memory and I am pretty sure that I will need this ONE precious line of perl/bash script in the future. At that time I won't spend any time googling again for it.

Replace all the occurrences of "apple" with "banana" in all the files found recursively from the current folder.

perl -p -i -e "s/apple/banana/g" `find . -name * `

Thanks to : http://joseph.randomnetworks.com/2005/08/18/perl-oneliner-recursive-search-and-replace/