ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Júlio Cesar Bueno Cotta <juliocbco...@gmail.com>
Subject compare files line by line
Date Wed, 29 Jul 2009 20:21:24 GMT
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

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