Crazy "Find and Replace"

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
seodevhead
Forum Regular
Posts: 705
Joined: Sat Oct 08, 2005 8:18 pm
Location: Windermere, FL

Crazy "Find and Replace"

Post by seodevhead »

Hey guys...

I have a web application that has about 100+ php files that include some function calls that need to be renamed.

Example:

$var = functionOne($string);

CHANGE TO:

$var = functionTwo($string);

So essentially I would like to somehow have my text editor (dreamweaver) 'Find and Replace':

Find: functionOne
Replace: functionTwo

Easy enough... but do I really have to open all 100+ files within dreamweaver to do it all at once? Does anyone know any software out there that can scan entire folders at once and replace any text within the text documents? Any suggestions on a workflow for this is GREATLY appreciated. Thanks.
Adrianc333
Forum Newbie
Posts: 14
Joined: Sat Feb 17, 2007 5:44 am
Location: South Yorkshire, UK

Post by Adrianc333 »

Alot of useful results.

http://www.google.co.uk/search?hl=en&q= ... arch&meta=

Though, couldn't you just edit the actions within your function?
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

  1. Download eclipse.
  2. Start a new project with your files in it.
  3. Open one file with that function name somewhere in the file.
  4. Click on the function name once.
  5. Go to Search->Search->Replace and choose in Project (or workspace) and about 10 seconds later it is done.
nickvd
DevNet Resident
Posts: 1027
Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:

Post by nickvd »

Everah wrote:
  1. Download eclipse.
PSPad also has this ability.

Search -> Search/Replace in Files...
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Make sure you backup and have some sort of testing to ensure fatal "function doesn't exist!" errors don't popup. SVN preferred.
User avatar
seodevhead
Forum Regular
Posts: 705
Joined: Sat Oct 08, 2005 8:18 pm
Location: Windermere, FL

Post by seodevhead »

Thanks for the tips guys.. but I think I need something a little more robust in a windows shell, that is easy to use for a dummy like me....

Anyone heard of "Actual Search & Replace"?

http://www.divlocsoft.com/
User avatar
wtf
Forum Contributor
Posts: 331
Joined: Thu Nov 03, 2005 5:27 pm

Post by wtf »

DW has do what you are asking. When you open "find+replace" make sure your "Find in" points to a directory or wherever the files are. This will do file+replace without having to open each single file.
User avatar
seodevhead
Forum Regular
Posts: 705
Joined: Sat Oct 08, 2005 8:18 pm
Location: Windermere, FL

Post by seodevhead »

wtf wrote:DW has do what you are asking. When you open "find+replace" make sure your "Find in" points to a directory or wherever the files are. This will do file+replace without having to open each single file.
Really? I tried it and it opens each individual file in Dreamweaver. Granted, it does perform the search and replace... but the whole "load each file into dreamweaver" is a bit excessive, especially for potentially 200+ files.
visitor-Q
Forum Commoner
Posts: 72
Joined: Mon Feb 05, 2007 1:40 am

Post by visitor-Q »

seodevhead wrote:Thanks for the tips guys.. but I think I need something a little more robust in a windows shell, that is easy to use for a dummy like me....

Anyone heard of "Actual Search & Replace"?

http://www.divlocsoft.com/
you could write a shell script. or search for an exisiting shell script.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

I'm telling you, Eclipse handles this very efficiently without opening files.
User avatar
wtf
Forum Contributor
Posts: 331
Joined: Thu Nov 03, 2005 5:27 pm

Post by wtf »

DW has never opened files for me. It just warns me that changes to unopened files are irreversible. Can't ctrl-z it.
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

Nope, dreamweaver doesn't open the files when doing a sitewide find and replace. Handles the job very nicely
Post Reply