You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by christoforever <ch...@gmail.com> on 2009/11/19 19:19:57 UTC

Regular expression for deleting new lines with Ant

I'm trying to remove all the new lines and/or lines full of tabs or white
space from a file ... its not working however... I've used the following
code.

					<replaceregexp file="${outputFile}"
									match="^[ \t\n]+$"
									replace=""
									byline="true"/>


but I've got nothing. I originally posted on the coderanch forums
(http://www.coderanch.com/t/471737/Ant-Maven-Other-Build-Tools/Regular-expression-deleting-new-lines)
and have gotten no reply so I've come here for help... any ideas?
-- 
View this message in context: http://old.nabble.com/Regular-expression-for-deleting-new-lines-with-Ant-tp26421426p26421426.html
Sent from the Ant - Users mailing list archive at Nabble.com.


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


Re: Regular expression for deleting new lines with Ant

Posted by christoforever <ch...@gmail.com>.
That's exactly what I ended up using. I cross-posted this on stack overflow
and someone gave me the idea their as well. I'm still curious about why
replaceregexp is not noticing the "\n' character. One day when I have the
time I will look into it a bit more.


foamdino wrote:
> 
> Hi,
> 
> I just had to strip blank lines from a file the other day, try this:
> 
> http://ant.apache.org/manual/CoreTypes/filterchain.html#linetokenizer
> 
> Kev
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Regular-expression-for-deleting-new-lines-with-Ant-tp26421426p26496235.html
Sent from the Ant - Users mailing list archive at Nabble.com.


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


Re: Regular expression for deleting new lines with Ant

Posted by Kevin Jackson <fo...@gmail.com>.
Hi,

I just had to strip blank lines from a file the other day, try this:

http://ant.apache.org/manual/CoreTypes/filterchain.html#linetokenizer

Kev

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


RE: Regular expression for deleting new lines with Ant

Posted by "Moore, Kent" <Ke...@fnis.com>.
Will "fixcrlf" help with at least some of what you are trying to
accomplish?

http://ant.apache.org/manual/CoreTasks/fixcrlf.html


-----Original Message-----
From: christoforever [mailto:christoforever@gmail.com] 
Sent: Thursday, November 19, 2009 1:20 PM
To: user@ant.apache.org
Subject: Regular expression for deleting new lines with Ant


I'm trying to remove all the new lines and/or lines full of tabs or
white
space from a file ... its not working however... I've used the following
code.

					<replaceregexp
file="${outputFile}"
	
match="^[ \t\n]+$"
	
replace=""
	
byline="true"/>


but I've got nothing. I originally posted on the coderanch forums
(http://www.coderanch.com/t/471737/Ant-Maven-Other-Build-Tools/Regular-e
xpression-deleting-new-lines)
and have gotten no reply so I've come here for help... any ideas?
-- 
View this message in context:
http://old.nabble.com/Regular-expression-for-deleting-new-lines-with-Ant
-tp26421426p26421426.html
Sent from the Ant - Users mailing list archive at Nabble.com.


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

_____________

The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you.
_____________

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


Re: Regular expression for deleting new lines with Ant

Posted by "Scot P. Floess" <sf...@nc.rr.com>.
If I remember correctly, someone had a similar question...  To get around 
the issue they used one of the Java built in properties like 
${line.separator} instead of \n for example...


On Thu, 19 Nov 2009, christoforever wrote:

>
> I'm trying to remove all the new lines and/or lines full of tabs or white
> space from a file ... its not working however... I've used the following
> code.
>
> 					<replaceregexp file="${outputFile}"
> 									match="^[ \t\n]+$"
> 									replace=""
> 									byline="true"/>
>
>
> but I've got nothing. I originally posted on the coderanch forums
> (http://www.coderanch.com/t/471737/Ant-Maven-Other-Build-Tools/Regular-expression-deleting-new-lines)
> and have gotten no reply so I've come here for help... any ideas?
> -- 
> View this message in context: http://old.nabble.com/Regular-expression-for-deleting-new-lines-with-Ant-tp26421426p26421426.html
> Sent from the Ant - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-890-8117 (Work)

Chief Architect JPlate   http://sourceforge.net/projects/jplate
Chief Architect JavaPIM  http://sourceforge.net/projects/javapim

Architect Keros          http://sourceforge.net/projects/keros

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