|
|
发表于 2011-6-30 09:47:14
|
显示全部楼层
本帖最后由 tmplinshi 于 2011-6-30 13:09 编辑
11# xslxslxsl
那三条代码加回去了。
================================
. 表示 1 个任意字符。不表示空字符。
.* 表示 0 个,或 0 个以上任意字符。
================================
用 fr 删除第五列是“59”或“67”或“b”或“a”或“t”或空字符的行:- fr *.txt -r:"^.*\t.*\t.*\t.*\t(59|67|[bat])?\t.*\n?" -t
复制代码 (\n 后面的 ?,是为了避免最后一行没有换行。)
强烈推荐 fr!我刚才测试了一千个文件,fr 用了 2 秒,sed (4.14) 用了 27 秒。以下是用 timieit 计算的结果:
Average for #fr.bat key over 1 runs
Version Number: Windows NT 5.1 (Build 2600)
Exit Time: 8:00 am, Monday, January 1 1601
Elapsed Time: 0:00:02.187
Process Time: 0:00:00.078
System Calls: 19314
Context Switches: 8589
Page Faults: 3166
Bytes Read: 4853881
Bytes Written: 847969
Bytes Other: 158000
Average for #sed.bat key over 1 runs
Version Number: Windows NT 5.1 (Build 2600)
Exit Time: 8:00 am, Monday, January 1 1601
Elapsed Time: 0:00:27.484
Process Time: 0:00:00.093
System Calls: 810124
Context Switches: 34826
Page Faults: 6223
Bytes Read: 5148897
Bytes Written: 11314757
Bytes Other: 3662156 |
|