2011-08-19 3 views
8

tengo tarea ant que invoca tarea replaceregexpde salida de línea nueva expresión regular carbón en virtud de Java o ANT

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

file.temp es

A1 
A2 

salida deseada es

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

Qué insertar como nueva línea de caracteres para producir la salida deseada en el parámetro ant replaceregexp?

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

Respuesta

16

Los siguientes obras para mí:

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

Wow, thaks!))) – popalka

Cuestiones relacionadas