以下是文件
AMQ8409: Display Queue details. QUEUE(TEST1) TYPE(QLOCAL) CURDEPTH(0) MAXDEPTH(1000) AMQ8409: Display Queue details. QUEUE(TEST2) TYPE(QLOCAL) CURDEPTH(0) MAXDEPTH(5000) AMQ8409: Display Queue details. QUEUE(TEST3) TYPE(QLOCAL) CURDEPTH(0) MAXDEPTH(5000)
我需要使用VB脚本
格式化上面的文件,如下所示QUEUE(TEST1) TYPE(QLOCAL) CURDEPTH(0) MAXDEPTH(1000) QUEUE(TEST2) TYPE(QLOCAL) CURDEPTH(0) MAXDEPTH(5000) QUEUE(TEST3) TYPE(QLOCAL) CURDEPTH(0) MAXDEPTH(5000)
答案 0 :(得分:0)
对您感兴趣的部分使用RegExp:
Dim reX : Set reX = New RegExp
reX.Global = True
reX.Pattern = "\w+\(\w+\)"
Dim sAll : sAll = goFS.OpenTextFile("..\data\in.txt").ReadAll()
WScript.Echo sAll
Dim oMTS : Set oMTS = reX.Execute(sAll)
Dim nMT
For nMT = 0 To oMTS.Count - 1 Step 4
WScript.Echo Join(Array(oMTS(nMT + 0), oMTS(nMT + 1), oMTS(nMT + 2), oMTS(nMT + 3)))
Next
输出:
AMQ8409: Display Queue details.
QUEUE(TEST1) TYPE(QLOCAL)
CURDEPTH(0) MAXDEPTH(1000)
AMQ8409: Display Queue details.
QUEUE(TEST2) TYPE(QLOCAL)
CURDEPTH(0) MAXDEPTH(5000)
AMQ8409: Display Queue details.
QUEUE(TEST3) TYPE(QLOCAL)
CURDEPTH(0) MAXDEPTH(5000)
QUEUE(TEST1) TYPE(QLOCAL) CURDEPTH(0) MAXDEPTH(1000)
QUEUE(TEST2) TYPE(QLOCAL) CURDEPTH(0) MAXDEPTH(5000)
QUEUE(TEST3) TYPE(QLOCAL) CURDEPTH(0) MAXDEPTH(5000)