Find/ replace within many php files at once??

by 7 replies
9
Is there any way to find/ replace the text within many php files at once? I want to make theme-wide changes to a wordpress theme. So, I need a program that will search through a the theme folder, through the internal folders to all the php files and preform the find and replace function.

Any Help?
#programming #files #find or #php #replace
  • Most software made for web programming will have this function. I use Netbeans IDE. Also Notepad++ is very popular. Both are free.

    -Ryan
    • [1] reply
    • If you've got shell access, you can do this in the blink of an eye like this:


      Code:
      find ./ -type f | xargs sed -i 's/original_text/replacement_text/g'
      Running that in a directory will recursively replace all occurrences of 'original_text' with 'replacement_text' .
  • Its primarily for wordpress templates and plugins. All the files are in a folder, and I want to do a find and replace for all the files in each folder without having to open each file manually. I could do it easily if I only had to do one file but you know most themes and plugins have 23, 30, 50+ files.

    @RJP will those programs work with what I'm trying to do?
    • [1] reply
    • Yes, both responses will satisfy what you need. The second is the easier way if you're familiar with shell (and have access), but an IDE/Notepad++ is easier if you aren't familiar with SSH.
  • Banned
  • The obvious- Dreamweaver. Just add the folder in the 'My Sites' folder and search through all the files in your site.
  • Any decent text editor will do that. I use UltraEdit, but there of course are others.

Next Topics on Trending Feed

  • 9

    Is there any way to find/ replace the text within many php files at once? I want to make theme-wide changes to a wordpress theme. So, I need a program that will search through a the theme folder, through the internal folders to all the php files and preform the find and replace function. Any Help?