Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a folder tree structure with hundreds of java files distributed in various sub folders
I want to replace a word Foo with FooBar in each and every file
Individual instances of Foo should change to FooBar and Foo.functionName() should change to FooBar.functionName()
But something such as myFooVar should not be changed
What is the easiest way to do this in Windows XP? ( I have grep from GnuWin32 installed, if it can be used in anyway)

share|improve this question

2 Answers 2

This looks like a code refactoring task of a sizeable Java project. I generally recommend to use an Integrated Development Environment in that case.

Eclipse is pretty nice and can perform refactoring like renaming identifiers (even in comments and documentation). For specific help and tutorials on that topic hit the official help pages or look for more extensive resources on the net.

share|improve this answer
    
the reason I was asking this is because I am new to Eclipse and I am not sure how to do it. How do I replace this word in all the files of the java project using Eclipse? –  user13267 Oct 15 '13 at 13:53

First of all, be sure that you have a version control system or any other kind of backup.
It may be very hard to revert bulk replaces.

  1. Install Notepad++ http://notepad-plus-plus.org/download
  2. Open it and press Ctrl+H
  3. Fill the form with your options.

Notepad++ find and replace in files

You can do much more complex operations, even multiline, with a power of regular expressions.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.