I need to recursively search for a specified string within all files and subdirectories within a directory and replace this string with another string.
I know that t
This works best for me on OS X:
grep -r -l 'searchtext' . | sort | uniq | xargs perl -e "s/matchtext/replacetext/" -pi
Source: http://www.praj.com.au/post/23691181208/grep-replace-text-string-in-files