find-replace question

1 view
Skip to first unread message

Dennis Fogg

unread,
Jun 15, 2007, 8:31:31 PM6/15/07
to raytec...@googlegroups.com
Anyone know how to do a "find-replace" for all files in a directory tree (or an IDE project)
to do a global replace for a project?
I was using dreamweaver to do this, but now i find out (with my version of dreamweaver)
that it only searchs in "source code" or "html text" but not both -- yes, it actually
misses instances that are not in the specified type!
Eclipse used to do this for Java, I'm not sure if the PHP varient of eclipse does this.
 
Dennis
 

Mario J Obejas

unread,
Jun 18, 2007, 12:11:09 PM6/18/07
to raytec...@googlegroups.com

I can't resist:

raytec...@googlegroups.com wrote on 06/15/2007 05:31:31 PM:
> Anyone know how to do a "find-replace" for all files in a directory
> tree (or an IDE project)

Do you want to replace a string inside the file with another string or do you want to rename a file?

cd <directory of interest>
find . -exec xxxxxxxxxxxxxxxxxxxxx   \;

where the xxxxxxxxxxxxxxxxxxxxx depends on your answer above.

Regardless of implementation, the hard part is making the find rule accurate so that you don't replace something you wanted to leave alone.

The other nice thing about the command line approach is that you can craft it so that it tells you what it will do without actually doing it first . Can Dreamweaver do that or not?

It's a very good way to test before committing.

Dennis Fogg

unread,
Jun 19, 2007, 12:10:24 AM6/19/07
to raytec...@googlegroups.com
Thanks, Mario.
I actually put in the time to learn find ... ain't that easy.
And, when i ran it in cygwin, it was pretty slow.
But at least it works!
Good to have lots of tools at your disposal!
 
Dennis

 
Reply all
Reply to author
Forward
0 new messages