Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2311722
  • 博文数量: 527
  • 博客积分: 10343
  • 博客等级: 上将
  • 技术积分: 5565
  • 用 户 组: 普通用户
  • 注册时间: 2005-07-26 23:05
文章分类

全部博文(527)

文章存档

2014年(4)

2012年(13)

2011年(19)

2010年(91)

2009年(136)

2008年(142)

2007年(80)

2006年(29)

2005年(13)

我的朋友

分类: LINUX

2006-07-05 15:58:57

cvs log -N
可以避免一个文件的tag被显示出来, 这可以保持输出的header部分比较短:
RCS file: /Amsrc/ColorPrint/DrvCfgFiles/en/DGI.xml,v
Working file: en/DGI.xml
head: 1.2
branch:
locks: strict
access list:
keyword substitution: kv
total revisions: 13;    selected revisions: 13
description:

但, 还不是最短, 往往需要看的只是revision 信息
cvs 没有一个跟 -h/-t 相对应的开关避免显示header信息.
很多方法可以把header信息过滤掉:

sed:
cvs log filename | sed '1,/^-------*$/d'

awk:
cvs log filename | awk 'BEGIN{a=0}(a==1){print $0}/^----/{a=1}'

perl:
#!/usr/bin/perl
#

### due to the limited cvs log input, read it all-in-one
my @all_rev_str = ;

my $first_rev_begin = 0;
foreach $line (@all_rev_str)
{
  print $line if $first_rev_begin;
  $first_rev_begin = 1 if($first_rev_begin == 0 && $line =~ /^----------------------------\r?\n/ )
}
这是好读一点的版本, 也可以一类似awk那样搞定
cvs log file_name | perl -n -e 'print if $a;$a=1 if /^---/;'

bash:
cvs log file_name | (export a="";while read l; do [ $a != "" ] && echo "$a,$l"; [ "${l/----------------------------/}" = "" ] && [ "$l" != "" ] && a=1; done)
阅读(1100) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~