I am converting a long time batch file build to using
jenkins and
ant.. so far all good.
but I have this little problem I just can't seem to find a good solution for..
as part of my build process, I generate a version.txt file that contains content from one of the source files.
here is the batch file version
rem put int he fixed text
echo -n 'version=' >version.txt
rem find the source line 'my $version = "x.yz"'
rem get the number part without the quotes
grep -i 'my $version' $source_file | grep -o -P '(?<=\").+?(?=\")' >>version.txt
so, I grep the file, get the one line, then regex extract just the x.yz part, then append it to the file created in step one.
this gets published along with the install file so that the automated installers can get for my package release level.
(without having to open my tar.gz to read the same file).
so I have tried (echo followed by real exec),
get [exec] grep missing ')'
the echoed data works cut/paste at the common prompt
<echo> ""grep -i 'my $version' ${src.file} | grep -o -P '(?<=\").+?(?=\&")' >> version.txt""</echo>
<exec executable="sh">
<arg value="-c" />
<arg line=""grep -i 'my $version' ${src.file} | grep -o -P '(?<=\").+?(?=\")' >> version.txt""/>
</exec>
which looks like this after the expansion
"grep -i 'my $version' ${src.file} | grep -o -P '(?<=\").+?(?=\")' >> version.txt"