Hello, how can I delete every n-th (4000th) char (space character) in a file (.txt or .sql) best via batch or vbs?
Thanks in advance!
Hello, how can I delete every n-th (4000th) char (space character) in a file (.txt or .sql) best via batch or vbs?
Thanks in advance!
You need some VBScript, you can't do this with a batch file. So something like this will do it for you
option Explicit
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Dim fso
Dim inFile
Dim outFile
Dim buffer
set fso = CreateObject("Scripting.FileSystemObject")
Set inFile = fso.OpenTextFile("C:\testIn.txt", ForReading)
Set outFile = fso.OpenTextFile("C:\testOut.txt", ForWriting, True)
Do While Not inFile.AtEndOfStream
buffer = inFile.Read(3999)
outFile.Write buffer
If Not inFile.AtEndOfStream Then
inFile.Read (1)
End If
Loop
inFile.Close
outFile.Close
Hope this helps :)