3

I am trying to write up a batch file that would run a schedule where it would get an log file in xml. Now whenever the batch file would run it would get it for today.

This is what I written very basic, Maybe reason why I am getting it wrong.

svn log -v -r {%date%} --xml http://repositorylocation.com > op7.xml

Now when I do that I get not only the date i need but the three letter ancrynom for day. And i need that removed but dont know how . Any advice?

I am running this on Windows XP.

Thank you.

2
  • Do you have cygwin? sed/awk or perl is great for manipulating strings... Commented Aug 3, 2012 at 21:28
  • 1
    %date% format is governed by short date format (regional settings), so simplest would be to just set that to whatever you need. It you can't, or do not want to set it user wide, you could check techniques in this answer Commented Aug 3, 2012 at 21:49

2 Answers 2

2

http://subversion.tigris.org/issues/show_bug.cgi?id=2849

The above seems to suggest that you could effect the date format by tweaking your locale, but that's a pretty bad hack... If the date format you are getting is reliably adding 0's in front of month and day hatbyzero's might work

The painful but extremely reliable way to do it is to parse the xml, parse the date and then reformat the date, set the value in the xml and then write the the fixed xml to a file This might be doable in groovy using xml slurper.

http://groovy.codehaus.org/Reading+XML+using+Groovy%27s+XmlSlurper

Sign up to request clarification or add additional context in comments.

3 Comments

It is kinda tough for me to use, but it did work. Thank you for your assistance.
I did say it was the "painful but reliable way" :). Glad you found it helpful.
True lol, Should of seen that coming but thank you it is very helpful.
1

Try the following:

set MONTH=%date:~4,2%
set DAY=%date:~7,2%
set YEAR=%date:~10,4%

That should give you the Month, Day, and Year, respectively. You can then handle that in your log file any way you want, i.e.

svn log -v -r {%MONTH%-%DAY%-%YEAR%} --xml http://repositorylocation.com > op7.xml

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.