我询问了question。 about file。 我接受了答复并撰写了以下文 rub:
file = File.open( X:myfile.txt , r )
file.each_line do |line|
ccyy = line[53...57]
mmdd = line[57...61]
line[53...57] = mmdd
line[57...61] = ccyy
File.open( c:myfile_MODIFIED.txt , a ) do |f2|
f2.puts line
end
end
这一文字将投入生产,并改变档案,但生产是一个窗户,只允许用纸张。 Unfortunatley I havn t written any in VB before. 某人能否帮助将上述法典的肉类改成真?
我迄今所做的是:
Dim oFolder, oFile, sText, ots
Set OFSO = CreateObject("Scripting.FileSystemObject")
Set oFolder = OFSO.GetFolder("X:myfolder")
Set RegXP=New RegExp
RegXP.IgnoreCase=1
RegXP.Pattern="PROD_FILE_d+.txt"
For Each oFile in oFolder.Files
If (RegXP.test(oFile.Name)) Then
WScript.Echo oFile.Name
set ots = OFSO.opentextfile(oFile)
Do While Not ots.AtEndOfStream
sText = ots.ReadLine
read file line by line. change characters in the line. write line to new file
Loop
ots.close
End If
Next