Douglas Kramer wrote:
PROBLEM 1:
I want to set the date in the version.properties file of my project.
In the past I've used this Unix command to get today's date:
DATE=`date '+%d %b %Y'` // 26 Jan 2005
That is, how can I set the date and assign it to a variable in Ant?
Okay, I found <tstamp> so that solves that problem.
PROBLEM 2:
Then I want to replace the date in the file below.
It looks like the Replace task won't work because it cannot do a wildcard
search. This is what I've been using:
sed "s/build...*)/build date: $DATE)/" < $VERSION_PROPERTIES >
$VERSION_PROPERTIES_NEW
I wrote this exec task, and it runs without an error message, but
outputs the wrong string altogether:
<exec dir="${makedir}"
executable="sed"
input="version.properties"
output="version.properties.new"
<arg line="4,4 s/build...*)/build date: ${DATE})/" />
</exec>
The output file contains an "Unrecognized command" error message:
% more version.properties.new
Unrecognized command: 4,4
Why does consider "4,4" to be a command?
If I delete "4,4", then it considers the sed command to be garbled:
% more version.properties.new
sed: command garbled: s/build...*)/build
BTW, the sed command does this:
from line 4 to 4, search for "build...*)" and replace with "build date: $DATE)"
-->
-Doug
----------------------- version.properties ---------------------------
#
# @(#)version.properties
#
mifdoclet.version=1.5 beta 1 and 1.4 beta 1 (build date: 26 Jan 2005)
----------------------------------------------------------------------
I suppose I could separate out the date and make it a separate property,
and then use the PropertyFile task to update it.
-Doug
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]