I want to replace mysql_real_escape_string with mysqli_real_escape_string in all php files on ubuntu desktop.... how do I do that?

@note - If this is a duplicate, then the "related questions" needs to be fixed

1 Answer 1

find . -name *.php -type f -print0 |
xargs -0 sed -i 's/mysql_real_escape_string/mysqli_real_escape_string/g'
  • I fixed some typos in your command line (no argument to -type, and you were using -0 on xargs without -print0 on find).
    – larsks
    Dec 13, 2010 at 19:33
  • Left the "g" off of the last escape_strin but that's perfect, thanks
    – Ben
    Dec 13, 2010 at 21:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.