⑴ 關於bat批處理過濾文件字元的問題
你可以把234.txt的內容粘貼出來
你這樣弄一張圖片怎麼編輯吶?
觀察了一下
發現你要的這個回紅色標記是以答空格作為分割符
取的第八列
並且帶有數字
for /f "tokens=8* delims= " %%a in ('type 234.txt') do echo %%a|findstr [0-9]
⑵ 請問怎樣的文本過濾如何寫VBS或者BAT代碼
Set FSO = CreateObject("Scripting.FileSystemObject")
set f=fso.opentextfile("a.txt",1)
Dim MyArray()
i=0
Do Until f.AtEndOfStream
ReDim Preserve MyArray(i)
MyArray(i)=f.readline
i=i+1
loop
f.close
length = UBound(MyArray)
i=0
while i<length
w=instr(MyArray(i),"@")
if w<>0 then
y=mid(MyArray(i),1,w-1)
j=i+1
while j<=length
w=instr(MyArray(j),"@")
if w<>0 then
y1=mid(MyArray(j),1,w-1)
if y=y1 then
MyArray(j)="*"
end if
end if
j=j+1
wend
end if
i=i+1
wend
Dim NewArray()
j=0
i=0
while i<=length
if MyArray(i)<>"*" then
reDim Preserve NewArray(j)
NewArray(j)=MyArray(i)
j=j+1
end if
i=i+1
wend
set f=fso.opentextfile("a1.txt",2,true)
length = UBound(NewArray)
i=0
while i<=length
f.writeline NewArray(i)
i=i+1
wend
f.close
msgbox "OK"
說明:程序編的有些拙劣,不過可以實現你的操作
程序中「@」為英文模式
結果生成「.txt」文件
VBS代碼