Reputation: 121
I want to replace Logger.getLogger to LogManager.getLogger in my project and project have hundreds of java files .How I do this?
Upvotes: 0
Views: 358
Reputation: 123
If you're using eclipse: Select your project with left click. Press Ctrl-H, select FileSearch. Enter your searchg strin in 'Containing text', *.java 'File name patterns' in narrow the search to 'Selected resources'.Then press replace and you're done.
Upvotes: 0
Reputation: 1685
If you are using eclipse click on "Search" menu than search for "File", enter the text to search for and select "enclosing project", than hit the bottom right "Replace" button. After the search action is completed eclipse will show up a dialog where you can type the text to replace. Check the preview and than complete the action.
Upvotes: 0
Reputation: 1246
Most IDEs have the ability to search and find where a class or method is used. In Eclipse select a class or method, right click, references, project. If you can use both at the same time, the go through and replace. Alternatively replace your current calls with a helper method that calls your current logger and then replace the logger.
Upvotes: 0
Reputation: 171
Search->File menu, enter the text to search for, hit the Replace... button which will give you another dialog where you can replace tex
ctrl + h is the shortcut ;)
Upvotes: 0
Reputation: 107
That is very easy to be done with sublime text. Just install it and take a look at this question -> Sublime text 2 - find and replace globally ( all files and in all directories )
Upvotes: 0
Reputation: 7744
for i in `find -name "*java"`; do sed -i "s/Logger.getLogger/LogManager.getLogger/g" $i; done
:)
Upvotes: 1