如何替换所有匹配的行?我想替换 *xml 文件中的所有匹配行。下面的脚本片段仅替换一行提前谢谢。brgds
<?xml version="1.0" encoding="windows-1252" ?>
<project default="init" basedir=".">
<property file="build.properties"/>
<target name="init">
<tstamp/>
<loadfile property="jndiurl"
srcfile="${src.model}/META-INF/persistence.xml">
<filterchain>
<linecontains>
<contains value="hibernate.jndi.url"></contains>
</linecontains>
</filterchain>
</loadfile>
<replace file="${src.model}/META-INF/persistence.xml" token="${jndiurl}"
value="${hibernate.jndi.url.live}${line.separator}"/>
<echo>${hibernate.jndi.url.live}</echo>
<loadfile property="providerurl"
srcfile="${src.structure}/com/arsivist/structure/connection.properties">
<filterchain>
<linecontains>
<contains value="providerurl"></contains>
</linecontains>
</filterchain>
</loadfile>
<replace file="${src.structure}/com/arsivist/structure/connection.properties"
token="${providerurl}"
value="${providerurl.live}${line.separator}"/>
<echo>${providerurl.live}</echo>
<loadfile property="ucmusername"
srcfile="${src.roketsanutil}/com/arsivist/util/ucmConnection.properties">
<filterchain>
<linecontains>
<contains value="username"></contains>
</linecontains>
</filterchain>
</target>
</project>