- 论坛徽章:
- 0
|
原帖由 zljjg2000 于 2006-8-25 10:08 发表
例如:文件file
Port 1:2
Name VID Protocol Addr Flags Proto Ports
xianfu-new 151 221.0.2.41 /30 ------f------- ANY 1/1
p-cq-quzhengfu-ep0 25 ...
能够将"Name"和“Flags:”之间的内容提取出来吗?可以用什么样的规则表达式呢?
hi.
yes!
TIPS:
before doing that, you should analyse your data structure, which fixed rule you
can get?
I see. there are 6 fields (or columns) in the records' header:
(NAME, VID, PROTOCAL_ADDR, FLAGS, PROTO, PORTS)
In first 2 fields (NAME, VID) and last 2 fields (PROTO, PORTS) there are fixed format,
but between PROTOCAL_ADDR and FLAGS there is no clear rules, therefor using
split /\s+/, .. will not match your correct request.
But you can use regex to match it per line.
Best regards,
ulmer
-------------
Schoenes Wochenende! |
|