Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 24th Apr 2010, 03:54 PM   #1
Long Time Warrior
War Room Member
 
Mike Adams's Avatar
 
Join Date: 2008
Location: United States
Posts: 582
Thanks: 15
Thanked 108 Times in 54 Posts
Blog Entries: 2
Default
Find/ replace within many php files at once??
Share on: 
fb share twitter share gplus share more share

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?

P.S. If you found my post useful, please click the "Thanks" button below...
Mike Adams is offline  
Unread 24th Apr 2010, 03:58 PM   #2
Peaceful Warrior
War Room Member
 
theIMgeek's Avatar
 
Join Date: 2009
Location: Calgary
Posts: 277
Thanks: 16
Thanked 106 Times in 63 Posts
Default
Re: Find/ replace within many php files at once??
Share on: 
fb share twitter share gplus share more share

Most software made for web programming will have this function. I use Netbeans IDE. Also Notepad++ is very popular. Both are free.

-Ryan

FREE WSO: Protect and Automatically Deliver Your Digital Products

Ask the Internet Marketing Geek
<-- Happy to help with technical challenges
MiniSiteMaker.org <-- Free software to make your mini-sites fast and easy
theIMgeek is offline  
Unread 24th Apr 2010, 04:04 PM   #3
VIP Warrior
 
mojojuju's Avatar
 
Join Date: 2005
Location: Potemkin Village
Posts: 1,724
Thanks: 745
Thanked 742 Times in 498 Posts
Default
Re: Find/ replace within many php files at once??
Share on: 
fb share twitter share gplus share more share

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' .

:)
mojojuju is offline  
Unread 24th Apr 2010, 11:17 PM   #4
Long Time Warrior
War Room Member
 
Mike Adams's Avatar
 
Join Date: 2008
Location: United States
Posts: 582
Thanks: 15
Thanked 108 Times in 54 Posts
Blog Entries: 2
Default
Re: Find/ replace within many php files at once??
Share on: 
fb share twitter share gplus share more share

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?

P.S. If you found my post useful, please click the "Thanks" button below...
Mike Adams is offline  
Unread 25th Apr 2010, 01:20 AM   #5
Active Warrior
 
Christopher Airey's Avatar
 
Join Date: 2010
Location: Maryland
Posts: 32
Thanks: 0
Thanked 4 Times in 4 Posts
Default
Re: Find/ replace within many php files at once??
Share on: 
fb share twitter share gplus share more share

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.
Christopher Airey is offline  
Unread 25th Apr 2010, 02:33 AM   #6
Banned
 
Join Date: 2009
Location: NE UK
Posts: 753
Thanks: 632
Thanked 261 Times in 230 Posts
Default
Re: Find/ replace within many php files at once??
Share on: 
fb share twitter share gplus share more share

RJL Software - Software - Utility - Simple Search-Replace does what it says on the can!
pjCheviot is offline  
Unread 25th Apr 2010, 08:19 PM   #7
Active Warrior
War Room Member
 
growclicks's Avatar
 
Join Date: 2010
Location: Chicago
Posts: 49
Thanks: 2
Thanked 7 Times in 7 Posts
Default
Re: Find/ replace within many php files at once??
Share on: 
fb share twitter share gplus share more share

The obvious- Dreamweaver. Just add the folder in the 'My Sites' folder and search through all the files in your site.
growclicks is offline  
Unread 25th Apr 2010, 11:05 PM   #8
Active Warrior
 
Join Date: 2010
Posts: 76
Thanks: 1
Thanked 4 Times in 4 Posts
Default
Re: Find/ replace within many php files at once??
Share on: 
fb share twitter share gplus share more share

Any decent text editor will do that. I use UltraEdit, but there of course are others.
Bellthorpe is offline  
Closed Thread


Bookmarks

Tags
files, find or, php, replace


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 06:57 AM.