保存为vbs- function gettext(fp)
- Set objStream = CreateObject("ADODB.Stream")
- objStream.CharSet = "utf-8"
- objStream.Open
- objStream.LoadFromFile fp
- gettext=objstream.readtext
- end function
- sub writetext(fp,t)
- Set objStream = CreateObject("ADODB.Stream")
- objStream.CharSet = "utf-8"
- objStream.Open
- objstream.writetext t
- objStream.savetoFile fp,2
- end sub
- set re=new regexp
- re.global=true
- t=gettext("目标.txt")
- for each l in split(gettext("清单.txt"),vbcrlf)
- if l<>"" then
- re.pattern=".*"&l&".*"
- tt=""
- if re.test(t) then
- writetext l&".txt",join(c2a(re.execute(t)),"")
- end if
- end if
- next
- function c2a(c)
- execute("dim arr("&c.count-1&")")
- for i=0 to c.count-1
- arr(i)=c(i)
- next
- c2a=arr
- end function
复制代码
|