本帖最后由 apang 于 2014-10-27 21:19 编辑
试试vbs,感觉可能会快一点- On Error Resume Next
- fileNum = 100
- Max = 0 : ReDim ar(fileNum)
- Set fso = CreateObject("Scripting.FileSystemObject")
-
- For i = 1 to fileNum
- Set f = fso.OpenTextFile("D:\数据3\" & i & ".txt")
- ar(i) = Split(RegEx(f.ReadAll), vbCrLf)
- If UBound(ar(i)) > Max Then Max = UBound(ar(i))
- f.Close : Set f = Nothing
- Next
-
- For i = 0 to Max
- s = ""
- For j = 1 to fileNum
- s = s & " " & ar(j)(i)
- Next
- fso.OpenTextFile("D:\数据3\all.txt", 8, true).WriteLine Mid(s, 2)
- Next
-
- MsgBox "OK"
-
- Function RegEx(txt)
- Set re = New RegExp
- re.Pattern = "^(\s*\n)+|(\s*\n)+$"
- re.Global = true
- txt = re.Replace(txt, "")
- re.Pattern = "(\s*\n)+"
- RegEx = re.Replace(txt, vbCrLf)
- End Function
复制代码
|