You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Gilbert Rebhan <an...@schillbaer.de> on 2005/10/18 19:41:02 UTC
replaceregexp problem
Hi,
i want to change one line in a txtfile.
1. if txtfile is like =
foo=bar
bla=bla
<property name="insert" value="123456"></property>
<replaceregexp file="J:\test\bla.txt"
match="bla.*"
replace="\0:${insert}">
</replaceregexp>
works as it should, gives me =
foo=bar
bla=bla:123456
2. but if txtfile is like =
foo=bar
bla=bla
foobar=foobar
means the line to be altered is not the last line
my snippet above gives me =
foo=bar
bla=bla
:123456
foobar=foobar
What went wrong, how to get it right ?
Any ideas ?
Regards, Gilbert
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: replaceregexp problem
Posted by Gilbert Rebhan <an...@schillbaer.de>.
Hi,
Jeffrey E Care wrote:
> Play around with the @flags & @byline; I think those will be able to solve
> your problem.
>
yup =
<replaceregexp file="J:\test\bla.txt"
match="bla.*"
replace="\0:${insert}"
byline="true">
</replaceregexp>
did it.
Thanks !!
bye4now, Gilbert
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: replaceregexp problem
Posted by Jeffrey E Care <ca...@us.ibm.com>.
Play around with the @flags & @byline; I think those will be able to solve
your problem.
--
Jeffrey E. Care (carej@us.ibm.com)
WebSphere v7 Release Engineer
WebSphere Build Tooling Lead (Project Mantis)
Gilbert Rebhan <an...@schillbaer.de> wrote on 10/18/2005 01:41:02 PM:
> Hi,
>
> i want to change one line in a txtfile.
>
> 1. if txtfile is like =
>
> foo=bar
> bla=bla
>
> <property name="insert" value="123456"></property>
>
> <replaceregexp file="J:\test\bla.txt"
> match="bla.*"
> replace="\0:${insert}">
> </replaceregexp>
>
> works as it should, gives me =
>
> foo=bar
> bla=bla:123456
>
> 2. but if txtfile is like =
>
> foo=bar
> bla=bla
> foobar=foobar
>
> means the line to be altered is not the last line
>
> my snippet above gives me =
>
> foo=bar
> bla=bla
> :123456
> foobar=foobar
>
> What went wrong, how to get it right ?
> Any ideas ?
>
> Regards, Gilbert
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>