Problem: You have a big file with many many line. For doing your task, you have to split it to small files. Each file contains about M lines.
Solution: Create new file with extension is VBS (example split.vbs). Fill to it following code
‘Language: VBScript
‘Operating System: Windows XP, Windwos Vista
‘Author: Phung Van Huy (Y!M: huyphungvan – GoogleTalk: huyphungvan)
‘Website: http://huypv.net/blog/
‘##################################################################
Const M = 1000
Set objFSO = CreateObject(“Scripting.Filesystemobject”)
Set objTS = objFSO.OpenTextFile(“big.txt“)
intFile = 1
intLine = 1
While Not objTs.AtEndOfStream
strLine = objTS.ReadLine
If intLine Mod M = 1 Then
If IsObject(objTS2) Then objTS2.Close
Set objTS2 = objFSO.OpenTextFile(“small/” & intFile & “.txt“, 8, 1)
intFile = intFile + 1
End If
If intLine Mod M = 0 Then
intLine = 0
objTS2.Write strLine
Else
objTS2.WriteLine strLine
End If
intLine = intLine + 1
Wend
objTS2.Close
Set objTs = Nothing : Set objTS2 = Nothing : Set objFSO = Nothing
Msgbox “Split complete”, 0, “PVH”
Save!
Now, create new directory small if it doesn’t exist
Double click to split.vbs you have just create above. (If not work, you can run: cmd – cscript split.vs)