批处理或VBS编辑 文本文件^(..)'
请高手帮忙做个VBS脚本或是批处理要做的工作是读A.txt文件修改后保存在同目录新建文件名为B.txt比如:A.txt文件为:alsdk(1)fjals(2)dkgja(...
请高手帮忙做个VBS脚本或是 批处理
要做的工作是读A.txt文件修改后保存在同目录新建文件名为B.txt
比如:
A.txt文件为:
alsdk(1)
fjals(2)
dkgja(3)
sldkj(4)
galsd(5)
kfjas(6)
dlkgj(7)
alsdk(8)
fjasl(9)
dkgja(0)
lsjdg(.)
(...)
文件修改后为 B.txt 如下
alsdk(1) kfjas(6) lsjdg(.)
fjals(2) dlkgj(7) (...)
dkgja(3) alsdk(8)
sldkj(4) fjasl(9)
galsd(5) dkgja(0)
重要的是为5行
谢谢!大家能帮帮我!!! 展开
要做的工作是读A.txt文件修改后保存在同目录新建文件名为B.txt
比如:
A.txt文件为:
alsdk(1)
fjals(2)
dkgja(3)
sldkj(4)
galsd(5)
kfjas(6)
dlkgj(7)
alsdk(8)
fjasl(9)
dkgja(0)
lsjdg(.)
(...)
文件修改后为 B.txt 如下
alsdk(1) kfjas(6) lsjdg(.)
fjals(2) dlkgj(7) (...)
dkgja(3) alsdk(8)
sldkj(4) fjasl(9)
galsd(5) dkgja(0)
重要的是为5行
谢谢!大家能帮帮我!!! 展开
1个回答
展开全部
不懂VBS,以下是VB代码
Private Sub Command1_Click()
Dim a() As String, b(4) As String
Open "C:\Documents and Settings\Administrator\桌面\a.txt" For Input As #1
a = Split(Input(LOF(1), 1), vbCrLf)
Close #1
Dim i As Long
For i = 0 To UBound(a)
b(i Mod 5) = b(i Mod 5) & a(i)
Next i
Open "C:\Documents and Settings\Administrator\桌面\b.txt" For Binary As #1
For i = 0 To 4
Put 1, , b(i) & vbCrLf
Next i
Close #1
End Sub
Private Sub Command1_Click()
Dim a() As String, b(4) As String
Open "C:\Documents and Settings\Administrator\桌面\a.txt" For Input As #1
a = Split(Input(LOF(1), 1), vbCrLf)
Close #1
Dim i As Long
For i = 0 To UBound(a)
b(i Mod 5) = b(i Mod 5) & a(i)
Next i
Open "C:\Documents and Settings\Administrator\桌面\b.txt" For Binary As #1
For i = 0 To 4
Put 1, , b(i) & vbCrLf
Next i
Close #1
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询