如何查找指定内容
Active ConnectionsProtoLocal Address Foreign Address State
TCP tyy001:1027 192.168.1.254:7499 ESTABLISHED
TCP tyy001:1030 192.168.1.228:11011 ESTABLISHED
TCP tyy001:1036 192.168.1.228:8089 ESTABLISHED
TCP tyy001:1042 192.168.1.228:720 ESTABLISHED
TCP tyy001:1050 192.168.1.254:9910 ESTABLISHED
TCP tyy001:1051 192.168.1.254:9911 ESTABLISHED
TCP tyy001:1127 119.147.18.89:https CLOSE_WAIT
TCP tyy001:1352 192.168.1.254:3389 ESTABLISHED
TCP tyy001:2186 192.168.1.228:25340 TIME_WAIT
TCP tyy001:2189 121.14.98.7:http ESTABLISHED
TCP tyy001:2200 121.14.76.245:http ESTABLISHED
TCP tyy001:2201 121.14.91.45:http ESTABLISHED
TCP tyy001:2204 124.115.7.140:http ESTABLISHED
TCP tyy001:2208 124.115.14.51:http ESTABLISHED
TCP tyy001:2210 113.142.13.143:http ESTABLISHED
TCP tyy001:2211 124.115.14.51:http ESTABLISHED
TCP tyy001:2214 124.115.7.140:http ESTABLISHED
TCP tyy001:2219 124.115.14.23:http ESTABLISHED
TCP tyy001:2226 192.168.1.228:25340 TIME_WAIT在上面的内容中找到 11011 前面的IP
在网上搜了半天知道要用 StringRegExp,但结果还是没弄明白 本帖最后由 afan 于 2009-8-13 12:18 编辑
保存以上为 1.txt。
如果有多个 11011 IP:$a = FileRead('1.txt')
$b = StringRegExp($a, "((\d{1,3}\.){3}\d{1,3}):11011", 3)
If @error <> 0 Then
MsgBox(0, 0, '无匹配项目')
Else
For $i = 0 To UBound($b) - 1 Step 2
MsgBox(0, 0, $b[$i])
Next
EndIf如果只1个 11011 IP:$a = FileRead('1.txt')
$b = StringRegExp($a, "((\d{1,3}\.){3}\d{1,3}):11011", 3)
If @error = 0 Then MsgBox(0, 0, $b[$i]) 如果只1个 11011 IP:$a = FileRead('1.txt')
$b = StringRegExp($a, "((\d{1,3}\.){3}\d{1,3}):11011", 3)
If @error = 0 Then MsgBox(0, 0, $b[$i])把最后的 MsgBox(0, 0, $b[$i])改成 $b)才能显示,不是很明白
第一个可以,先谢谢2楼的兄弟
页:
[1]