ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Davor Cengija <>
Subject Remove empty lines from a file?
Date Mon, 16 Sep 2002 15:35:57 GMT
I'm looking for a task which will remove all empty lines from a file.
Searching the mail archives I found some mentionings of replaceregexp
task, but I cannot force it to work as I wish.

I wrote my own custom task (first ever, I stared using Ant yesterday :-)
but it is rather cumbersome: it creates a temporary file, copies the
non-empty lines to it and then calls

I'd be much more happier with 'native' ant task, probably without temp

I'm using Ant 1.5.0 stable (+jakarta-oro-2.0.6 I think)

Any help is greatly appreciated.


P.S. Maybe I don't need removeemptylines task at all if I knew how to
use replaceregexp properly. I need to prepare some database dumps for
the distribution. Those dumps contains table definitions, as well as the
INSERT INTO lines. When I strip down those INSERT INTO lines, I have a
file with a few thousands of empty lines which I just don't want to be

This is how I use replaceregexp:


Regexp is matched but CR/LF remains regardes of the flag I use. 

One important issue: when the first INSERT INTO is encountered,
everything after that until the end of file can be stripped.

Is the replaceregexp the solution for my problem?

Thanks again :-)

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message