我正在尝试在ant中执行一些次要的文件操作。我检索了一个表空间列表,我希望使用ALTER TABLESPACE作为其前缀,并使用NOT LOGGED作为后缀,如下所示:
<loadfile property="zos.prepend.tablespaces" srcFile="${basedir}/zos-tablespaces-DIRTY.txt">
<filterchain>
<!-- Order here is important -->
<prefixlines prefix="ALTER TABLESPACE "/>
<suffixlines suffix=" NOT LOGGED"/>
<trim/>
<replaceregex pattern=".*NAME.*|.*-----.*|.*record.*select.*|^ALTER TABLESPACE$" replace=""/>
<trim/>
<ignoreblank/>
</filterchain>
</loadfile>
<echo file="${basedir}/zos-tablespaces-PREPEND.txt">
${zos.prepend.tablespaces}
</echo>当我这样做的时候,我得到了前置的ok,但是后缀似乎附加到了下一行。你知道怎么做前缀和后缀吗?
发布于 2013-04-17 03:20:52
我真的想通了。I后缀行添加在CRLF之后的每一行输入的末尾,而不是仅仅在前面。所以我只需要在添加后缀后清除CRLF。这就是最终奏效的方法。现在我只需要让它更干净一点
<filterchain>
<tabstospaces/>
<prefixlines prefix="ALTER TABLESPACE "/>
<trim/>
<replaceregex pattern=".*NAME.*|.*record.*select.*|.*-----.*|^ALTER TABLESPACE$" replace=""/>
<suffixlines suffix=" NOT LOGGED @"/>
<striplinebreaks/>
<tokenfilter>
<replacestring from="LOGGED @" to="LOGGED @${line.separator}"/>
</tokenfilter>
<tabstospaces/>
<trim/>
<replaceregex pattern="^NOT LOGGED @$" replace=""/>
<tabstospaces/>
<trim/>
<ignoreblank/>
<fixcrlf eol="crlf" eof="add"/>
</filterchain>https://stackoverflow.com/questions/16042448
复制相似问题