Warrior Forum - The #1 Digital Marketing Forum & Marketplace

Warrior Forum - The #1 Digital Marketing Forum & Marketplace (https://www.warriorforum.com/)
-   Programming (https://www.warriorforum.com/programming/)
-   -   Find/ replace within many php files at once?? (https://www.warriorforum.com/programming/205342-find-replace-within-many-php-files-once.html)

Mike Adams 24th April 2010 03:54 PM

Find/ replace within many php files at once??
 
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?

theIMgeek 24th April 2010 03:58 PM

Re: Find/ replace within many php files at once??
 
Most software made for web programming will have this function. I use Netbeans IDE. Also Notepad++ is very popular. Both are free.

-Ryan

mojojuju 24th April 2010 04:04 PM

Re: Find/ replace within many php files at once??
 
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' .

Mike Adams 24th April 2010 11:17 PM

Re: Find/ replace within many php files at once??
 
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?

Christopher Airey 25th April 2010 01:20 AM

Re: Find/ replace within many php files at once??
 
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.

pjCheviot 25th April 2010 02:33 AM

Re: Find/ replace within many php files at once??
 
RJL Software - Software - Utility - Simple Search-Replace does what it says on the can!

growclicks 25th April 2010 08:19 PM

Re: Find/ replace within many php files at once??
 
The obvious- Dreamweaver. Just add the folder in the 'My Sites' folder and search through all the files in your site.

Bellthorpe 25th April 2010 11:05 PM

Re: Find/ replace within many php files at once??
 
Any decent text editor will do that. I use UltraEdit, but there of course are others.


All times are GMT -6. The time now is 07:15 AM.