ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vihan Pandey" <>
Subject Re: replaceregex issues
Date Mon, 27 Aug 2007 14:34:59 GMT
> <replaceregex pattern="[\.\./]{1,}(h.+)" replace="\1" flags="m"/>

Thanks a million Gilbert !!! I REALLY appreciate all the effort you
have taken in thinking of this and testing it out :-) However i've
noticed something strange that the replaceregex task fails in
cretain(but not all) cases(if there are a VERY large number of files
nested in a deep directory structure and/or the files are a little
messed up).

We have developers working Windows, GNU/Linux and Mac OS X who check
in these files into a subversion respository(from which we check out
via an ant script then deploy). The result of this heterogeneous
development environment is a lot of ^M's and other control and escape
characters all over the place thus a nicely structured file with good
newlines becomes a one liner full of of junk characters and looked
messed up. This is not a problem as the webserver can read the file on

After a lot of thinking i decided to use sed in a shellscript via
sed(which in my experience is the best for such messed up files).

Here is what i did :

                <shellscript shell="bash">
                        (for i in `find /path/to/my/files/ -name
\*.html -print`;do cat $i | sed s/[..\/]*http/http/g > $i.tmp; cat
$i.tmp > $i; rm -rf $i.tmp;done)

                <shellscript shell="bash">
                        (for i in `find /path/to/my/files/ -name
\*.shtml -print`;do cat $i | sed s/[..\/]*http/http/g > $i.tmp; cat
$i.tmp > $i; rm -rf $i.tmp;done)

This seems to work perfectly.

But again, Thanks a million Gilbert - i REALLY appreciate it :-) i
will surely use your method when i need it :-)

Thanks again!!!



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message