0

I have around 100 classes in which I have a string literal, let's say "ABC". I want to replace this literal with the classname for each of this file. I can go to each class and replace it. But is there a shorter way of doing it??

Example -

In file classA.java -> replace ABC with classA

In file classB.java -> replace ABC with classB

and so on..

Please note that I want different strings to be replaced in different files. Surely, I can do it the normal way(open file and replace the string), but i don't want to do it for 100-200 files. Please read the question carefully before blindly marking it as duplicate.

praneel
  • 21
  • 1
  • 6
  • 2
    You'll be happy to know that this question already has an answer here: [Replace String in all files in Eclipse](https://stackoverflow.com/questions/6800799/replace-string-in-all-files-in-eclipse) – Cardinal System Jan 02 '18 at 06:43
  • 1
    "Search" menu > File > search text > "Replace..." button – ernest_k Jan 02 '18 at 06:44
  • I want the 'new text' to be different for each file and to match the class name. – praneel Jan 02 '18 at 10:17
  • 1
    Any simple reading of the original question would have shown that this question is different from the referenced "duplicate" question. – David M. Karr Jan 02 '18 at 16:42
  • Concerning the OQ, this is the sort of thing that I would use Emacs for. I create a grep listing of all the strings I want to change, and on the first one I record a keyboard macro to do the replacement, terminating the macro with the key to go to the next search occurrence. I then repeat the macro 9999 (just hitting 9 a bunch of times). – David M. Karr Jan 02 '18 at 16:44

0 Answers0