-2

I need to replace one line of code in all my Java entities with either shell scripts or any other better approach.

Need to replace:

@SequenceGenerator(name = "sequence", sequenceName = "sequence_name", allocationSize = 1)

With:

@GeneratedValue(strategy = GenerationType.IDENTITY)
  • It seems you forgot to include a question in your question. – Biffen Apr 04 '19 at 13:33
  • 1
    What posesses someone to format the words ‘*shell scipt*’ in monospace?! – Biffen Apr 04 '19 at 13:35
  • @DheerajChouhan Simply adding a question mark to a sentence doesn’t make it a (good) question. Please [edit] the post to contain an _actual_ question. Right now it’s all just a requirement. We can’t tell with what you need help. – Biffen Apr 04 '19 at 13:37
  • @Biffen actually its not the question, its a simple requirement and i need better approach to do that. – Dheeraj Chouhan Apr 05 '19 at 05:01

3 Answers3

0

Do it with an text editor like Notepad++, open all java entities and do the change for all open entities.

Mini Nihat
  • 38
  • 5
0

There are couple of ways you can do this

1) If you want to use shell, you can use sed command for inline editing

2) You can write a java class of your whole where you read all files in a given folder, iterate over them, and access them in edit mode to have a replace based on your logic. To read file individually, you can use BufferedReader. Have a look at this post

3) If you have notepad++ installed, you can open notepad++, press ctrl +f, go to third tab 'Find in files` and give your details as to what is to be replaced with what and in which directory

Ashishkumar Singh
  • 3,580
  • 1
  • 23
  • 41
-1

Maybe this link can be useful for you if you can use bash

Link: How to do a recursive find/replace of a string with awk or sed?

find /home/www -type f -print0 | xargs -0 sed -i 's/subdomainA\.example\.com/subdomainB.example.com/g'

You'll need remplace with your strings.

Tlaloc-ES
  • 4,825
  • 7
  • 38
  • 84