我需要在一个简单的循环中打印当天的所有SVN版本,但我无法解析它们。
我需要的是循环每天的修订。我的问题是在脚本中获取修订日期和修订号,例如:
log=$(svn log -r {2011-11-01}:Head)
startDate= #??? get first commit date from log
startCommit= #?? get first revision number from log
for $rev in $(log); do
# revisionDate=??? (similar to startdate)
# revisionNumber=??? (similar to start commit)
if [! $startDate = $revisionDate ]; then
echo $revisionDate
echo $revisionNumber
fi
done
这是svn日志的示例:
------------------------------------------------------------------------
r1619603 | aw | 2014-08-21 23:33:35 +0200 (Thu, 21 Aug 2014) | 2 lines
YARN-2436. [post-HADOOP-9902] yarn application help doesn't work
------------------------------------------------------------------------
r1619604 | jlowe | 2014-08-21 23:38:16 +0200 (Thu, 21 Aug 2014) | 2 lines
HADOOP-10893. isolated classloader on the client side. Contributed by Sangjin Lee
------------------------------------------------------------------------
r1619614 | jlowe | 2014-08-22 00:41:34 +0200 (Fri, 22 Aug 2014) | 2 lines
YARN-2434. RM should not recover containers from previously failed attempt when AM restart is not enabled. Contributed by Jian He
------------------------------------------------------------------------
r1619626 | sandy | 2014-08-22 01:28:44 +0200 (Fri, 22 Aug 2014) | 1 line
MAPREDUCE-5130. Add missing job config options to mapred-default.xml (Ray Chiang via Sandy Ryza)
------------------------------------------------------------------------
r1619632 | aw | 2014-08-22 01:58:25 +0200 (Fri, 22 Aug 2014) | 1 line
HADOOP-8896. Javadoc points to Wrong Reader and Writer classes in SequenceFile (Ray Chiang via aw)
------------------------------------------------------------------------
答案 0 :(得分:1)
svn log
输出可以重定向到某个文件,可用于进一步提取有用信息。 PFB脚本提供所需日期的日志: -
#!/bin/bash
svn log > svn_logs_today.txt
printf "Enter the date in format YYYY-MM-DD for which revision no. to be displayed\n"
read var
#today=`date +%Y-%m-%d`
#if required today variable can be used for extracting todays report
cat svn_logs_today.txt| grep $var