How do I remove non-tokens during copy in Ant?
I have files that I need cleaned up during the build process. There is a fixed string that I need开发者_如何学Go removed everywhere it appears. The files are being copied so during that copy I tried including a filterset
where the token is the text to be removed and the value is the empty string. This didn't work because I set begintoken
and endtoken
to the empty string and Ant didn't like that.
This is not a one time operation so it needs to be part of the build process. The files contain SQL INSERT statements and are used to populate tables at runtime. Each line references the schema plus the table name and I need just the table name, e.g.
insert into Schema1.Table1 ...
should be
insert into Table1 ...
Thank you!
Use a nested filterchain with tokenfilter, something like =
<copy todir="...">
<fileset dir="..." />
<filterchain>
<tokenfilter>
<replacestring from="Schema1." to="" />
</tokenfilter>
</filterchain>
</copy>
if you need regexp for replacement use =
...
<tokenfilter>
<replaceregex pattern="..." replace="..." flags="".../>
</tokenfilter>
...
instead.
精彩评论