ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@yahoo.com>
Subject Re: Remove empty lines from a file?
Date Mon, 16 Sep 2002 16:08:16 GMT
How did you try replaceregexp>?  I would think it
ought to work...

-Matt

--- Davor Cengija <davor.cengija@mail.inet.hr> wrote:
> 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
> java.io.File#rename().
> 
> I'd be much more happier with 'native' ant task,
> probably without temp
> files.
> 
> I'm using Ant 1.5.0 stable (+jakarta-oro-2.0.6 I
> think)
> 
> Any help is greatly appreciated.
> 
> Thanks!
> 
> 
> 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
> there.
> 
> This is how I use replaceregexp:
> 
> <replaceregexp 
> 	file="${file}"
> 	match="^INSERT.INTO.*$$"
> 	replace=""
> 	byline="true"
> 	flags="s"/>
> 
> 
> 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:  
> <mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:ant-user-help@jakarta.apache.org>
> 


__________________________________________________
Do you Yahoo!?
Yahoo! News - Today's headlines
http://news.yahoo.com

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message