Igor Moiseev Applied mathematician, Web Developer

Find and substitute the string in all files with `sed` command on GNU/Linuxedit

Small and powerful command to find and substitute the old_phrase with the new_phrase in all files and directories recursively with sed command on GNU/Linux

find . -type f -print0 | xargs -0 sed -i 's/old_phrase/new_phrase/g'

Attention! The previous command finds files also in the hidden folders and if you're working with Subversion or GIT you'd like to skip them. The following keys -not -path '*/\.*' makes the trick

find . -not -path '*/\.*' -type f -print0 | xargs -0 sed -i 's/old_phrase/new_phrase/g'