2011-08-19 12 views
8

私はreplaceregexpタスク出力改行文字またはANT

<target name="regexp.replace"> 
    <replaceregexp file="${file.temp}" 
        match="(.*)" 
        replace="first operation on \1 second operation on \1" 
        byline="true"/> 
</target> 

file.tempを呼び出すAntターゲットを持って

A1 
A2 

所望の出力は

first operation on A1 
second operation on A1 
first operation on A2 
second operation on A2 

は何になっていますant replaceregexpパラメータに目的の出力を生成するための新しい行のcharとして挿入しますか?

replace="first operation on \1 %NEW_LINE% second operation on \1" 

答えて

16

私のために、次の作品:

<replaceregexp file="test.txt" 
       match="(.*)" 
       replace="first operation on \1${line.separator}second operation on \1" 
       byline="true"/> 
+0

うわー、thaks! ))))) – popalka

関連する問題