Maybe you should try something like ant replaceregexp :
task myCopy << { ant.replaceregexp(match:'aaa', replace:'bbb', flags:'g', byline:true) { fileset(dir: 'src/main/java/android/app/cfg', includes: 'TestingConfigCopy.java') } }
This task will replace all aaa events with bbb . In any case, this is just an example, you can change it for your own purposes or try some similar solution using ant.
source share