〖Linux〗svn log 每个日志记录只显示一行的方法

vi ~/.bashrc,增加一个function

 

 1 svnlog(){
 2     svn log "$@" | awk -f <(cat <<EOF
 3 #!/usr/bin/awk -f
 4 
 5 # Convert the "svn log" output into a one liner format, which is easier to grep
 6 # or use in scripts. Pipe "svn log" into this script
 7 
 8 # When we get a line that starts with a revision number, put the data in variables
 9 /^r[0-9]+/ {
10     rev=\$1
11     user=\$3
12     date=\$5
13     time=\$6
14     lines=13
15 }
16 
17 # Anything that isn't a revision line, a separator line or an empty line
18 # will be part of the commit message. Concatenate these into the comment variable
19 ! (/^r[0-9+]/ || /^-+$/ || /^$/) {
20   comment = comment \$0
21 }
22 
23 # With every separator line, output what we stored before and reset the comment variable
24 # To skip the first line we also check if we've already stored a revision
25 /^-+$/ && rev {
26    print rev " | " user " | " date " | " time " | " comment
27    comment = ""
28 }
29 EOF
30 )
31 }

 awk正则表达式参考的是:https://gist.github.com/plexus/1485222

使用方法:svnlog -l 10

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值