Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Phing: append files while adding a newline between them

Tags:

phing

I'm trying to concatenate several files together using Phing, while leaving a newline between the content of different files. I'm using the append task to concatenate them but I can't figure out how to add the new line. Is there a way to do that without resorting to a custom task?

like image 477
SlackOverflow Avatar asked Mar 20 '26 06:03

SlackOverflow


1 Answers

Following the suggestion of a colleague, I ended up using this:

<filterchain>
    <replaceregexp>
        <regexp pattern="([^\n])$" replace="$1${line.separator}" ignoreCase="true"/>
    </replaceregexp>
</filterchain>

...inside the append task.

like image 58
SlackOverflow Avatar answered Mar 24 '26 16:03

SlackOverflow