ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Weintraub <qazw...@gmail.com>
Subject Re: compare files line by line
Date Thu, 30 Jul 2009 16:10:06 GMT
Take a look at this task: <
http://ant.apache.org/manual/OptionalTasks/replaceregexp.html>

And, then take a look at this: <
http://ant.apache.org/manual/CoreTypes/regexp.html>

It appears that the two might be related. If that's the case, you might be
able to use the <replaceregexp> somehow in the <regexp>.

Also take a look at TokenFilters <
http://ant.apache.org/manual/CoreTypes/filterchain.html#tokenfilter>. These
also work in filter chains.

I'll take a look at this, and see if I can figure out how to do a
comparison. I suspect that you have to do two loadreferences to get the file
contents into two properties and then do a compare among the properties.

2009/7/29 Júlio Cesar Bueno Cotta <juliocbcotta@gmail.com>

> Hello good people
> I am here again needing some help
> now I need to do a I script to compare two ".properties"..like
>
> First file Name: dev.properties
> @var1@=test1
>
> @var2@=test2
> @var3@=test3
>
> Secund fiel Name: prd.properties
> # comment
> @var1@=test1
>
> @var2@=test1037
>
> @var4@=test4
>
>
> I need to compare these two files and so fail the build if then have some
> differences..
> The files need to have the same numer of lines and each line must to have
> the same variable declared or to be a empty line or a comment.
> The variables declared in dev.properties must by declared ( in the same
> order ) in prd.properties and the variables in prd.properties must by in
> dev.properties, but the values of these variables can be different.
> So..the files should be like this to don't fail the build:
>
> dev.properties
> # comment
> @var1@=test1
>
> @var2@=test2
>
> @var3@=test3
>
> @var4@=test4
>
> prd.properties
> # comment
> @var1@=test1
>
> @var2@=test1037
>
> @var3@=test3
>
> @var4@=test4123
>
> That seens to be a idiot thing to do..but when I do a compare between these
> files
> I was trying to find something here
> http://ant.apache.org/manual/CoreTypes/filterchain.html#linecontainsregexp
>
> but I didn't find I way to compare line by line and I way to get the piece
> of each line before the "=" signal.
> the linecontainsregexp return all the line ..is there a "split method" in
> Ant ?
> Thanks all!
>
> --
>  Júlio Cesar Bueno Cotta
> Graduando em ciência da computação
>   Universidade Federal de Viçosa
>



-- 
David Weintraub
qazwart@gmail.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message