Home » Questions » Computers [ Ask a new question ]

How do I do a string replace in all PHP files recursively on Linux?

How do I do a string replace in all PHP files recursively on Linux?

I have a function name that was misspelled, and I want to change it. The function is called in many places of the project.

Asked by: Guest | Views: 324
Total answers/comments: 1
bert [Entry]

"This is exactly the same thing as John T's solution:

find ./ -type f -name ""*.php"" -exec sed -i 's/\<oldfunction\>/newfunction/g' {} \;

I usually don't pipe out to xargs

EDIT: more expensive.... per comments below."