Thank yo Mr. Cragun for the fast reply. Let me explain you completely.. My file contain multiple exceptions. For instance, see the below 3.
xyz (Exception) {
}
xyz (Exception) {
}
xyz (Exception) {
filhfs ijsdlfh sdlfhl }
In the above three different scenarios, no change required for 3rd scenario as there is data between curly braces.
I need the 1st & 2nd scenario to be handled as there is no data between curly braces and also, if there is space/tab exists in between the braces then it should be removed..
The output for the both 1st and 2nd scenarios should be same. I.e,
The "solution given is not working as expected" because you posted an inappropriate, truncated sample, and the files you are using are not NIX standard text files (containing extra win <CR> line terminating chars).
However, try (based on Don Cragun's proposal):