I need to replace a variable assignment statement using shell script. Eg: MyConstants.java file contains lines like
String abcd = "ABCD";
String abc = "ABC";
String e = abcd + "e";
I need to replace variable abcd as
String abcd = "newString";
String abc = "ABC";
String e = abcd + "e";
The problem is it contains \n \r characters in random manner like
String abcd =
"ABCD";
or
String abcd
=
"ABCD";
String abc = "ABC";
String e = abcd + "e";
I had a look at How to replace catch block in *.java using sed? But all commands are based on a single line pattern. (Takes input as a single line) How do I sort out this? Please help.