Apache Ant 内で、ファイル内の文字列を置き換えたいと思いますが、文字列の特定の出現に対してのみです。ループ番号の出現のみを置き換えたい for ループがあります (最初のループは最初の出現を見つけ、2 番目のループは 2 番目の文字列の出現を見つけます)、それに関連付けられている for ループのパラメーター値。
<exec executable="${postgres-bin-dir}/psql" outputproperty="update-primary-keys-values-@table">
<arg line="-A -t --host ${source-target-comparison-hostname} --port 5432 --username 'postgres' -d ${source-target-comparison-databasename} -c "array_to_string(ARRAY(select ${primary-keys-@{table}} from stage.@{table} t where t not in (select t from public.@{table} t) and t.${primary-keys-@{table}} not in (select ${primary-keys-@{table}} from stage.@{table} where ${primary-keys-@{table}} not in (select ${primary-keys-@{table}} from public.@{table})) order by ${primary-keys-@{table}}), ',')""/>
</exec>
<for list="${update-primary-keys-values-@table}" param="keys-values">
<replace file="${updates-dir}/updates@{table}.sql" token=");" value=") WHERE ${primary-keys-@{table}} = @{keys-values};"/>
</for>