I have a SQL file in which I want to replace a word with something else. But the catch here is, I would replace the word depending upon the occurrence of the previous two words and the next word.
For example, If the SQL file contains "INSERT INTO table_name VALUES"
then I just want to add a bracket to the table name and capitalize it.
so, after the changes, it would be "INSERT INTO [TABLE_NAME] VALUES"
.
I have tried using FileInputStream
and FileOutputStream
but I found that it might be not efficient in my case. The file has a lot of INSERT statements.
Please suggest some efficient idea for this.
String.replaceAll
?replaceAll
:)