Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2315312
  • 博文数量: 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)

我的朋友

分类: WINDOWS

2007-02-27 12:33:06

#!/usr/bin/bash
sed 's#\r\n#\n#' | awk $'
BEGIN{OFS=""}
/^Directory /{
d=substr($0,length($1)+2)
next
}
/^Listing module:/{
d=substr($0, 17)
next
}
(length($0)!=0) {
print d,"/",$0
}'
cvsnt 的ls命令输出格式为
Directory dir_1

file1
file2
Directory dir_2

Directory dir_3
或, 直接指定了module时是
Listing module: module_1
...

* awk的substr下标是从1 开始的
* 通过windows/cygwin的cvsnt ls命令得到的输出是 CR LF结尾的, 该例中如果不把它先转换为LF结尾的话输出结果会混乱
* cvsnt ls输出中目录信息是送至 stderr的, 所以必需用 2>&1 来重定向, 这个工作必需在cvs ls命令上做, 脚本中不能代劳
cvs ls -Rr tag_name Module 2>&1 | cvs_ls.sh
不过在一个大项目中这个命令也是很慢的.
阅读(1250) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~