免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 8434 | 回复: 8

求大牛解析pkt分析 [复制链接]

论坛徽章:
1
金牛座
日期:2014-03-21 18:22:34
发表于 2014-05-22 19:16 |显示全部楼层
之前我写的正则是这样的
open FH,'<',$file or die $!;
my $i= 0;
while(<FH>{
        chomp;
        #say $_;
        if($_ =~/^(\d+)\s+(\w+.\w+.\w+).\s\((\d+)\)$/){
                #say $_;
        }elsif($_ =~/^(\d+)\s+(\w+.\w+.\w+.\w+).\s\(\d+\)$/){
                #say $_;
        }elsif($_ =~/^(\d+)\s+(\w+.\w+.\w+.\w+.\w+).\s\(\d+\)$/){
                #say $_;
        }elsif($_ =~/^(\d+)\s+(\w+.\w+.\w+).\sA\s(\d+.\d+.\d+.\d+).\((\d+)\)$/){
                #say "$_";
        }elsif($_ =~/^(\d+)\s+(\w+.\w+.\w+.\w+).\sA\s(\d+.\d+.\d+.\d+).\((\d+)\)$/){
                #say "$_";
        }elsif($_ =~/^(\d+)\s+(\w+.\w+.\w+.\w+.\w+).\sA\s(\d+.\d+.\d+.\d+).\((\d+)\)$/){
                #say "$_";
        }elsif($_ =~/^(\d+)\s+(\w+.\w+.\w+.\w+.\w+).\sA\s(\d+.\d+.\d+.\d+).\((\d+)\)$/){
                #say "$_";
        }elsif($_ =~/^(\d+)\s+(\w+[-]\w+.\w+.\w+.\w+).\s\(\d+\)$/){
                #say "$_";
        }elsif($_ =~/^(\d+)\s+(\w+.\w+.\w+.\w+[-]\w+.\w+).\s\(\d+\)$/){
                #say "$_";
        }elsif($_ =~/^(\d+)\s+(\w+.\w+.\w+.\w+).\sCNAME\s(\w+.\w+.\w+.\w+).,\s(\w+.\w+.\w+.\w+.\w+).\sA\s(\d+.\d+.\d+.\d+)\s\(\d+\)$/){
                #say "$_";
        }elsif($_ =~/^(\d+)\s+(\w+.\w+.\w+.\w+).\sCNAME\s(\w+.\w+.\w+.\w+.\w+).,\s(\w+.\w+.\w+.\w+.\w+).\sA\s(\d+.\d+.\d+.\d+)\s\(\d+\)$/){
                #say "$_";
        }elsif($_ =~/^(\d+)\s+(\w+.\w+.\w+.\w+).\sCNAME\s(\w+[-]\w+[-]\w+.\w+.\w+).,\s(\w+[-]\w+[-]\w+.\w+.\w+).\sA\s(\d+.\d+.\d+.\d+)\s\(\d+\)$/){
                #say "$_";
        }elsif($_ =~/^(\d+)\s+(\w+.\w+.\w+.\w+).\sCNAME\s(\w+[-]\w+[-]\w+.\w+.\w+).,\s(\w+[-]\w+[-]\w+.\w+.\w+).\sA\s(\d+.\d+.\d+.\d+)\s\(\d+\)$/){
                #say "$_";
        }elsif($_ =~/^(\d+)\s+(\w+.\w+.\w+).\sA\s(\d+.\d+.\d+.\d+),\s(\w+.\w+.\w+).\sA\s(\d+.\d+.\d+.\d+)\s\(\d+\)$/){
                #say "$_";
        }elsif($_ =~/^(\d+)\s+(\w+.\w+.\w+.\w+).\sA\s(\d+.\d+.\d+.\d+),\s(\w+.\w+.\w+.\w+).\sA\s(\d+.\d+.\d+.\d+)\s\(\d+\)$/){
                #say "$_";
        }elsif($_ =~/^(\d+)\s+(\w+.\w+.\w+.\w+.\w+).\sA\s(\d+.\d+.\d+.\d+),\s(\w+.\w+.\w+.\w+.\w+).\sA\s(\d+.\d+.\d+.\d+),\s(\w+.\w+.\w+.\w+.\w+).\sA\s(\d+.\d+.\d+.\d+),\s(\w+.\w+.\w+.\w+.\w+).\sA\s(\d+.\d+.\d+.\d+)\s\(\d+\)$/){
                #say "$_";
        }else{
                say $_;
                $i++;
        }
}

如果这样子写下去可以解决问题,但不可否认,执行效率太差,两千多条的数据执行下来需要好长时间,而我处理的数据可能有个200M左右,每天执行,这样写完全不行
希望大牛帮忙看一下有没有好的方法

格式:258        gw5.push.mcp.weibo.cn. A 111.13.87.242, gw5.push.mcp.weibo.cn. A 111.13.87.185 (216)
那么我想取到
258 gw5.push.mcp.weibo.cn 111.13.87.242  111.13.87.185
244    k.youku.com. CNAME gz-t-k.youku.com., gz-t-k.youku.com. A 183.61.116.54, gz-t-k.youku.com. A 183.61.116.55, gz-t-k.youku.com. A 183.61.116.56, gz-t-k.youku.com. A 183.61.116.52, gz-t-k.youku.com. A 183.61.116.53 (202)

244 gz-t-k.youku.com 183.61.116.54 183.61.116.55 183.61.116.56 183.61.116.52 183.61.116.53
其实就是取每条数据里面A前面的域名加后面的ip地址
如果没有A的话直接写到新的文件里面,有的话


具体也可以用下面的作为源文件:

442        dcys.ijinshan.com. A 114.112.93.204 (400)
279        service.cocounion.com. A 117.121.57.21 (237)
136        oc.gw.youmi.net. A 61.153.102.90 (94)
183        au.youmi.net. CNAME ym-au.b0.aicdn.com., ym-au.b0.aicdn.com. CNAME ctn.b9.aicdn.com., ctn.b9.aicdn.com. A 119.145.147.56 (141)
415        www.taobao.com. CNAME www.gslb.taobao.com.danuoyi.tbcache.com., www.gslb.taobao.com.danuoyi.tbcache.com. CNAME scorpio.danuoyi.tbcache.com., scorpio.danuoyi.tbcache.com. A 119.147.70.241, scorpio.danuoyi.tbcache.com. A 121.14.89.251, scorpio.danuoyi.tbcache.com. A 183.61.241.121, scorpio.danuoyi.tbcache.com. A 183.61.241.141 (373)
285        oc.umeng.co. A 211.151.139.210, oc.umeng.co. A 211.151.139.211 (243)
494        qzs.qq.com. CNAME qzs.tc.qq.com., qzs.tc.qq.com. CNAME qzs.tcdn.qq.com., qzs.tcdn.qq.com. A 183.60.217.22, qzs.tcdn.qq.com. A 183.61.180.23, qzs.tcdn.qq.com. A 113.105.137.20, qzs.tcdn.qq.com. A 113.105.137.21, qzs.tcdn.qq.com. A 113.105.137.22, qzs.tcdn.qq.com. A 113.105.137.23, qzs.tcdn.qq.com. A 113.108.88.20, qzs.tcdn.qq.com. A 119.147.227.16, qzs.tcdn.qq.com. A 119.147.254.21, qzs.tcdn.qq.com. A 119.147.254.22, qzs.tcdn.qq.com. A 183.60.217.16, qzs.tcdn.qq.com. A 183.60.217.17, qzs.tcdn.qq.com. A 183.60.217.18, qzs.tcdn.qq.com. A 183.60.217.19, qzs.tcdn.qq.com. A 183.60.217.20, qzs.tcdn.qq.com. A 183.60.217.21 (452)
249        data.flurry.com. A 216.52.203.13 (207)
155        aos.wall.youmi.net. A 58.63.244.77, aos.wall.youmi.net. A 58.63.244.64 (113)
354        oc.umeng.com. A 211.151.165.108, oc.umeng.com. A 211.151.165.107 (312)
74        dm.toutiao.com. (32)
357        dm.toutiao.com. CNAME i.snssdk.com., i.snssdk.com. CNAME snssdk.com., snssdk.com. A 60.29.248.126, snssdk.com. A 60.29.248.123, snssdk.com. A 60.29.248.124, snssdk.com. A 60.29.248.125 (315)
370        au.umeng.com. A 211.151.139.210, au.umeng.com. A 211.151.139.211, au.umeng.com. A 211.151.151.6 (32
79        ichannel.snssdk.com. (37)
355        ichannel.snssdk.com. CNAME i.snssdk.com., i.snssdk.com. CNAME snssdk.com., snssdk.com. A 60.29.248.125, snssdk.com. A 60.29.248.126, snssdk.com. A 60.29.248.123, snssdk.com. A 60.29.248.124 (313)
79        short.weixin.qq.com. (37)
219        short.weixin.qq.com. A 101.227.131.102, short.weixin.qq.com. A 101.226.76.175 (177)
463        kbd1.kpns.ijinshan.com. A 114.112.93.85, kbd1.kpns.ijinshan.com. A 114.112.93.84 (421)
78        push.wikielife.com. (36)
447        andmbd.tj.ijinshan.com. A 114.112.93.204 (405)
136        push.wikielife.com. A 42.121.253.78 (94)
342        dl.sj.ijinshan.com. CNAME dl.sj.ijinshan.ccgslb.com.cn., dl.sj.ijinshan.ccgslb.com.cn. CNAME download005.dbu.tel.ccgslb.com.cn., download005.dbu.tel.ccgslb.com.cn. A 119.134.254.147, download005.dbu.tel.ccgslb.com.cn. A 121.10.106.71 (300)
288        wifiapi02.51y5.net. CNAME wifi02.51y5.net., wifi02.51y5.net. A 175.102.131.21, wifi02.51y5.net. A 175.102.131.23, wifi02.51y5.net. A 175.102.131.33, wifi02.51y5.net. A 175.102.131.36 (246)
449        go.mobile.cloud.duba.net. A 221.228.204.32 (407)
388        alog.umeng.com. A 211.151.151.7, alog.umeng.com. A 211.151.151.8, alog.umeng.com. A 211.151.139.210, alog.umeng.com. A 211.151.139.211 (346)
451        kbd.data.kpns.ijinshan.com. A 114.112.93.83 (409)
279        user.wlanbanlv.com. A 121.199.251.172 (237)
292        msch.f.360.cn. CNAME mscan.f.360.cn., mscan.f.360.cn. CNAME mscan.f.qh-lb.com., mscan.f.qh-lb.com. A 211.151.197.91, mscan.f.qh-lb.com. A 211.151.197.81 (250)
78        pnewsapp.tc.qq.com. (36)
73        a0.pstatp.com. (31)
326        a0.pstatp.com. CNAME a0.pstatp.ccgslb.com.cn., a0.pstatp.ccgslb.com.cn. CNAME cc00088.h.tel.ccgslb.com.cn., cc00088.h.tel.ccgslb.com.cn. A 121.10.106.14, cc00088.h.tel.ccgslb.com.cn. A 202.104.237.73 (284)
278        vip.wlanbanlv.com. A 121.199.27.198 (236)
75        imgcache.qq.com. (33)
509        imgcache.qq.com. CNAME imgcache.tc.qq.com., imgcache.tc.qq.com. CNAME imgcache.tcdn.qq.com., imgcache.tcdn.qq.com. A 113.108.88.74, imgcache.tcdn.qq.com. A 119.147.254.19, imgcache.tcdn.qq.com. A 119.147.254.20, imgcache.tcdn.qq.com. A 183.61.180.18, imgcache.tcdn.qq.com. A 183.61.180.19, imgcache.tcdn.qq.com. A 183.61.180.20, imgcache.tcdn.qq.com. A 183.61.180.21, imgcache.tcdn.qq.com. A 183.61.180.22, imgcache.tcdn.qq.com. A 113.105.73.139, imgcache.tcdn.qq.com. A 113.105.73.140, imgcache.tcdn.qq.com. A 113.105.137.18, imgcache.tcdn.qq.com. A 113.105.137.19, imgcache.tcdn.qq.com. A 113.108.88.34, imgcache.tcdn.qq.com. A 113.108.88.50, imgcache.tcdn.qq.com. A 113.108.88.54, imgcache.tcdn.qq.com. A 113.108.88.58 (467)
87        app01.nodes.gslb.mi-idc.com. (45)
87        app01.nodes.gslb.mi-idc.com. (45)
284        app01.nodes.gslb.mi-idc.com. A 14.17.87.216, app01.nodes.gslb.mi-idc.com. A 58.68.235.232, app01.nodes.gslb.mi-idc.com. A 121.11.79.72 (242)
284        app01.nodes.gslb.mi-idc.com. A 121.11.79.72, app01.nodes.gslb.mi-idc.com. A 14.17.87.216, app01.nodes.gslb.mi-idc.com. A 58.68.235.232 (242)
74        mupdate.360.cn. (32)
273        mupdate.360.cn. CNAME mupdate.qh-lb.com., mupdate.qh-lb.com. A 211.151.122.170, mupdate.qh-lb.com. A 211.151.122.32 (231)
134        jmp1.jcloud.com. A 211.151.12.48 (92)
83        configsvr.msf.3g.qq.com. (41)
530        configsvr.msf.3g.qq.com. CNAME mq.mig.tencent-cloud.net., mq.mig.tencent-cloud.net. A 119.147.19.234, mq.mig.tencent-cloud.net. A 119.147.19.235, mq.mig.tencent-cloud.net. A 119.147.19.241, mq.mig.tencent-cloud.net. A 119.147.19.245, mq.mig.tencent-cloud.net. A 119.147.19.252, mq.mig.tencent-cloud.net. A 119.147.19.253, mq.mig.tencent-cloud.net. A 119.147.19.254, mq.mig.tencent-cloud.net. A 119.147.10.139, mq.mig.tencent-cloud.net. A 119.147.10.140, mq.mig.tencent-cloud.net. A 119.147.10.141, mq.mig.tencent-cloud.net. A 119.147.19.233 (48
356        cache.pack.google.com. CNAME redirector.c.pack.google.com., redirector.c.pack.google.com. A 203.208.48.134, redirector.c.pack.google.com. A 203.208.48.135, redirector.c.pack.google.com. A 203.208.48.136, redirector.c.pack.google.com. A 203.208.48.137, redirector.c.pack.google.com. A 203.208.48.142, redirector.c.pack.google.com. A 203.208.48.128, redirector.c.pack.google.com. A 203.208.48.129, redirector.c.pack.google.com. A 203.208.48.130, redirector.c.pack.google.com. A 203.208.48.131, redirector.c.pack.google.com. A 203.208.48.132, redirector.c.pack.google.com. A 203.208.48.133 (314)
162        collector.mobile.cnzz.com. A 42.156.162.25 (120)
133        api.3kwan.cn. A 121.11.69.18 (91)
135        api.wandoujia.com. A 60.28.208.11 (93)
188        api.3g.youku.com. CNAME zw-api-3g.youku.com., zw-api-3g.youku.com. A 220.181.154.145 (146)
188        api.3g.youku.com. CNAME zw-api-3g.youku.com., zw-api-3g.youku.com. A 220.181.154.145 (146)
188        api.3g.youku.com. CNAME zw-api-3g.youku.com., zw-api-3g.youku.com. A 220.181.154.145 (146)
201        like.video.qq.com. A 14.17.57.181 (159)
237        update.ppstream.com. CNAME update.pps.tv.webscache.com., update.pps.tv.webscache.com. A 183.61.168.145 (195)
213        r16---sn-a5m7znee.c.pack.google.com. CNAME r16.sn-a5m7znee.c.pack.google.com., r16.sn-a5m7znee.c.pack.google.com. A 173.194.12.181 (171)
242        vh01.ppstream.com. A 113.31.88.157 (200)
242        vh11.ppstream.com. A 221.238.19.122 (200)
242        vh02.ppstream.com. A 113.31.88.158 (200)
242        vh12.ppstream.com. A 221.238.19.123 (200)
280        adimg.mobile.sina.cn. CNAME adimg.gslb.sinaedge.com., adimg.gslb.sinaedge.com. CNAME weibo.grid.sinaedge.com., weibo.grid.sinaedge.com. A 14.17.79.152, weibo.grid.sinaedge.com. A 119.147.148.35, weibo.grid.sinaedge.com. A 14.17.79.151 (23
242        vh03.ppstream.com. A 113.31.88.159 (200)
242        vh13.ppstream.com. A 221.238.19.124 (200)
79        proxy.mobile.yy.com. (37)
242        vh04.ppstream.com. A 113.31.88.160 (200)
242        vh14.ppstream.com. A 218.75.153.16 (200)
241        aph.ppstream.com. A 113.31.88.161 (199)
242        flux.ppstream.com. A 113.31.88.162 (200)
419        mobilelog.kugou.com. A 42.62.54.152, mobilelog.kugou.com. A 42.62.54.161, mobilelog.kugou.com. A 42.62.54.178, mobilelog.kugou.com. A 42.62.20.217, mobilelog.kugou.com. A 42.62.20.218, mobilelog.kugou.com. A 42.62.30.53, mobilelog.kugou.com. A 42.62.30.55, mobilelog.kugou.com. A 42.62.54.151 (377)
241        v2h.ppstream.com. A 113.31.88.172 (199)
241        v3h.ppstream.com. A 115.231.40.84 (199)
79        utop.umengcloud.com. (37)
313        utop.umengcloud.com. CNAME api.m.taobao.com., api.m.taobao.com. CNAME api.m.split.taobao.com., api.m.split.taobao.com. A 42.156.184.20 (271)
78        pnewsapp.tc.qq.com. (36)
440        pnewsapp.tc.qq.com. CNAME pnewsapp.tcdn.qq.com., pnewsapp.tcdn.qq.com. CNAME ssd.tcdn.qq.com., ssd.tcdn.qq.com. A 119.147.254.194, ssd.tcdn.qq.com. A 183.60.217.63, ssd.tcdn.qq.com. A 113.105.73.197, ssd.tcdn.qq.com. A 113.108.88.68, ssd.tcdn.qq.com. A 119.147.254.63, ssd.tcdn.qq.com. A 119.147.254.64, ssd.tcdn.qq.com. A 119.147.254.193 (39
242        gw6.push.mcp.weibo.cn. A 111.13.89.71 (200)
296        agentchannel.api.duapp.com. CNAME agentchannel.api.n.shifen.com., agentchannel.api.n.shifen.com. A 115.239.210.219, agentchannel.api.n.shifen.com. A 115.239.210.246 (254)
427        vpic.video.qq.com. CNAME vpic.tc.qq.com., vpic.tc.qq.com. CNAME vpic.tcdn.qq.com., vpic.tcdn.qq.com. CNAME vpic.video.qq.com.lxdns.com., vpic.video.qq.com.lxdns.com. CNAME qq.xdwscache.glb0.lxdns.com., qq.xdwscache.glb0.lxdns.com. A 121.14.35.139, qq.xdwscache.glb0.lxdns.com. A 121.14.228.43, qq.xdwscache.glb0.lxdns.com. A 14.17.101.140, qq.xdwscache.glb0.lxdns.com. A 113.107.56.96 (385)
337        m.irs01.com. A 180.169.18.134, m.irs01.com. A 180.169.18.135, m.irs01.com. A 180.169.18.136, m.irs01.com. A 180.169.19.134, m.irs01.com. A 180.169.19.135, m.irs01.com. A 180.169.19.136 (295)
211        sdk.m.youku.com. A 183.61.116.67, sdk.m.youku.com. A 183.61.116.64, sdk.m.youku.com. A 183.61.116.65, sdk.m.youku.com. A 183.61.116.66 (169)
453        b.scorecardresearch.com. CNAME b.scorecardresearch.com.edgesuite.net., b.scorecardresearch.com.edgesuite.net. CNAME a1294.w20.akamai.net., a1294.w20.akamai.net. A 124.40.52.83, a1294.w20.akamai.net. A 124.40.52.88, a1294.w20.akamai.net. A 124.40.52.89, a1294.w20.akamai.net. A 124.40.52.98, a1294.w20.akamai.net. A 124.40.52.105, a1294.w20.akamai.net. A 96.17.199.8, a1294.w20.akamai.net. A 96.17.199.27, a1294.w20.akamai.net. A 96.17.199.34 (411)
212        push.m.youku.com. A 220.181.154.166, push.m.youku.com. A 220.181.154.167, push.m.youku.com. A 220.181.154.164, push.m.youku.com. A 220.181.154.165 (170)
244        mqtt.m.youku.com. A 220.181.154.172, mqtt.m.youku.com. A 220.181.154.173, mqtt.m.youku.com. A 220.181.154.168, mqtt.m.youku.com. A 220.181.154.169, mqtt.m.youku.com. A 220.181.154.170, mqtt.m.youku.com. A 220.181.154.171 (202)
200        wxv.video.qq.com. A 14.17.32.228 (15
200        sns.video.qq.com. A 113.108.7.234 (15
343        isdspeed.qq.com. A 119.147.194.250, isdspeed.qq.com. A 119.147.193.122, isdspeed.qq.com. A 119.147.193.123, isdspeed.qq.com. A 119.147.193.125, isdspeed.qq.com. A 119.147.193.126, isdspeed.qq.com. A 119.147.193.138, isdspeed.qq.com. A 119.147.193.165, isdspeed.qq.com. A 119.147.194.210, isdspeed.qq.com. A 119.147.194.248, isdspeed.qq.com. A 119.147.194.249 (301)
284        app01.nodes.gslb.mi-idc.com. A 58.68.235.232, app01.nodes.gslb.mi-idc.com. A 121.11.79.72, app01.nodes.gslb.mi-idc.com. A 14.17.87.216 (242)
288        wifiapi02.51y5.net. CNAME wifi02.51y5.net., wifi02.51y5.net. A 175.102.131.36, wifi02.51y5.net. A 175.102.131.21, wifi02.51y5.net. A 175.102.131.23, wifi02.51y5.net. A 175.102.131.33 (246)
71        luyou360.cn. (29)
328        www.yytingting.com. A 117.25.150.73, www.yytingting.com. A 117.25.150.74, www.yytingting.com. A 117.25.150.75, www.yytingting.com. A 117.25.150.77, www.yytingting.com. A 117.25.150.79 (286)
78        pnewsapp.tc.qq.com. (36)
75        dev1.zypush.com. (33)
148        dev1.zypush.com. A 119.161.219.19, dev1.zypush.com. A 119.161.219.8 (106)
72        3gimg.qq.com. (30)
506        3gimg.qq.com. CNAME p31yuan2.tc.qq.com., p31yuan2.tc.qq.com. CNAME p31yuan2.tcdn.qq.com., p31yuan2.tcdn.qq.com. A 220.169.154.184, p31yuan2.tcdn.qq.com. A 222.73.132.183, p31yuan2.tcdn.qq.com. A 61.155.220.182, p31yuan2.tcdn.qq.com. A 113.17.185.185, p31yuan2.tcdn.qq.com. A 113.17.185.186, p31yuan2.tcdn.qq.com. A 113.105.73.195, p31yuan2.tcdn.qq.com. A 113.108.88.62, p31yuan2.tcdn.qq.com. A 117.21.185.46, p31yuan2.tcdn.qq.com. A 117.21.185.47, p31yuan2.tcdn.qq.com. A 119.97.181.53, p31yuan2.tcdn.qq.com. A 119.147.254.54, p31yuan2.tcdn.qq.com. A 122.228.70.183, p31yuan2.tcdn.qq.com. A 124.228.42.47, p31yuan2.tcdn.qq.com. A 124.228.42.48, p31yuan2.tcdn.qq.com. A 183.60.217.54, p31yuan2.tcdn.qq.com. A 183.61.180.57 (464)
83        configsvr.msf.3g.qq.com. (41)
530        configsvr.msf.3g.qq.com. CNAME mq.mig.tencent-cloud.net., mq.mig.tencent-cloud.net. A 119.147.10.139, mq.mig.tencent-cloud.net. A 119.147.10.140, mq.mig.tencent-cloud.net. A 119.147.10.141, mq.mig.tencent-cloud.net. A 119.147.19.233, mq.mig.tencent-cloud.net. A 119.147.19.234, mq.mig.tencent-cloud.net. A 119.147.19.235, mq.mig.tencent-cloud.net. A 119.147.19.241, mq.mig.tencent-cloud.net. A 119.147.19.245, mq.mig.tencent-cloud.net. A 119.147.19.252, mq.mig.tencent-cloud.net. A 119.147.19.253, mq.mig.tencent-cloud.net. A 119.147.19.254 (48
71        luyou360.cn. (29)
255        gw.gexin.channel.push.mcp.weibo.cn. A 111.13.88.252 (213)
235        log1.wtlogin.qq.com. A 113.108.6.154, log1.wtlogin.qq.com. A 183.61.32.182, log1.wtlogin.qq.com. A 113.108.6.148 (193)
76        pic4.qiyipic.com. (34)
351        pic4.qiyipic.com. CNAME img.dns.iqiyi.com., img.dns.iqiyi.com. CNAME wsctczhnngimdl01.dns.iqiyi.com., wsctczhnngimdl01.dns.iqiyi.com. A 121.14.155.62, wsctczhnngimdl01.dns.iqiyi.com. A 183.61.167.67, wsctczhnngimdl01.dns.iqiyi.com. A 183.61.167.68, wsctczhnngimdl01.dns.iqiyi.com. A 183.61.167.69, wsctczhnngimdl01.dns.iqiyi.com. A 183.61.167.70, wsctczhnngimdl01.dns.iqiyi.com. A 183.61.167.71, wsctczhnngimdl01.dns.iqiyi.com. A 183.61.167.72, wsctczhnngimdl01.dns.iqiyi.com. A 121.14.155.56, wsctczhnngimdl01.dns.iqiyi.com. A 121.14.155.58 (309)
222        api.gamex.mobile.youku.com. A 220.181.185.40, api.gamex.mobile.youku.com. A 220.181.185.41, api.gamex.mobile.youku.com. A 220.181.185.38, api.gamex.mobile.youku.com. A 220.181.185.39 (180)
76        pic7.qiyipic.com. (34)
351        pic7.qiyipic.com. CNAME img.dns.iqiyi.com., img.dns.iqiyi.com. CNAME wsctczhnngimdl01.dns.iqiyi.com., wsctczhnngimdl01.dns.iqiyi.com. A 121.14.155.58, wsctczhnngimdl01.dns.iqiyi.com. A 121.14.155.62, wsctczhnngimdl01.dns.iqiyi.com. A 183.61.167.67, wsctczhnngimdl01.dns.iqiyi.com. A 183.61.167.68, wsctczhnngimdl01.dns.iqiyi.com. A 183.61.167.69, wsctczhnngimdl01.dns.iqiyi.com. A 183.61.167.70, wsctczhnngimdl01.dns.iqiyi.com. A 183.61.167.71, wsctczhnngimdl01.dns.iqiyi.com. A 183.61.167.72, wsctczhnngimdl01.dns.iqiyi.com. A 121.14.155.56 (309)
76        pic9.qiyipic.com. (34)
351        pic9.qiyipic.com. CNAME img.dns.iqiyi.com., img.dns.iqiyi.com. CNAME wsctczhnngimdl01.dns.iqiyi.com., wsctczhnngimdl01.dns.iqiyi.com. A 121.14.155.56, wsctczhnngimdl01.dns.iqiyi.com. A 121.14.155.58, wsctczhnngimdl01.dns.iqiyi.com. A 121.14.155.62, wsctczhnngimdl01.dns.iqiyi.com. A 183.61.167.67, wsctczhnngimdl01.dns.iqiyi.com. A 183.61.167.68, wsctczhnngimdl01.dns.iqiyi.com. A 183.61.167.69, wsctczhnngimdl01.dns.iqiyi.com. A 183.61.167.70, wsctczhnngimdl01.dns.iqiyi.com. A 183.61.167.71, wsctczhnngimdl01.dns.iqiyi.com. A 183.61.167.72 (309)
74        log.snssdk.com. (32)
334        log.snssdk.com. CNAME snssdk.com., snssdk.com. A 60.29.248.126, snssdk.com. A 60.29.248.123, snssdk.com. A 60.29.248.124, snssdk.com. A 60.29.248.125 (292)
361        res.mfs.ykimg.com. CNAME mfs.ykimg.com., mfs.ykimg.com. A 121.14.141.12, mfs.ykimg.com. A 121.14.141.13, mfs.ykimg.com. A 121.14.141.14, mfs.ykimg.com. A 121.14.141.15, mfs.ykimg.com. A 121.14.141.16, mfs.ykimg.com. A 121.14.141.17, mfs.ykimg.com. A 121.9.207.45, mfs.ykimg.com. A 121.9.207.46, mfs.ykimg.com. A 121.9.207.47, mfs.ykimg.com. A 121.9.207.48, mfs.ykimg.com. A 121.9.207.49, mfs.ykimg.com. A 121.9.207.50 (319)
73        shouji.360.cn. (31)
81        api.weather.rj.91.com. (39)
286        shouji.360.cn. A 58.68.151.143 (244)
215        api.weather.rj.91.com. A 121.207.250.49, api.weather.rj.91.com. A 121.207.250.56, api.weather.rj.91.com. A 121.207.250.119, api.weather.rj.91.com. A 121.207.250.38 (173)
188        api.3g.youku.com. CNAME zw-api-3g.youku.com., zw-api-3g.youku.com. A 220.181.154.145 (146)
188        api.3g.youku.com. CNAME zw-api-3g.youku.com., zw-api-3g.youku.com. A 220.181.154.145 (146)
188        api.3g.youku.com. CNAME zw-api-3g.youku.com., zw-api-3g.youku.com. A 220.181.154.145 (146)
69        m.qpic.cn. (27)
439        m.qpic.cn. A 14.17.42.35, m.qpic.cn. A 14.17.52.151, m.qpic.cn. A 14.17.52.152, m.qpic.cn. A 113.108.16.32, m.qpic.cn. A 183.60.72.29, m.qpic.cn. A 183.60.72.40, m.qpic.cn. A 183.60.72.44, m.qpic.cn. A 183.60.72.45, m.qpic.cn. A 183.61.38.164, m.qpic.cn. A 183.61.38.192, m.qpic.cn. A 183.61.38.193, m.qpic.cn. A 183.61.38.200, m.qpic.cn. A 183.61.38.201, m.qpic.cn. A 183.61.38.202, m.qpic.cn. A 183.61.49.160, m.qpic.cn. A 14.17.32.221 (397)
75        data.flurry.com. (33)
249        data.flurry.com. A 216.52.203.13 (207)
76        agent.kuaibo.com. (34)
390        agent.kuaibo.com. A 60.55.32.84, agent.kuaibo.com. A 222.186.3.142, agent.kuaibo.com. A 222.186.3.143, agent.kuaibo.com. A 60.55.32.68 (34
151        159.129.135.117.in-addr.arpa. PTR . (109)
77        loc.map.baidu.com. (35)
265        loc.map.baidu.com. CNAME newloc.map.n.shifen.com., newloc.map.n.shifen.com. A 115.239.210.78 (223)
506        3gimg.qq.com. CNAME p31yuan2.tc.qq.com., p31yuan2.tc.qq.com. CNAME p31yuan2.tcdn.qq.com., p31yuan2.tcdn.qq.com. A 122.228.70.183, p31yuan2.tcdn.qq.com. A 124.228.42.47, p31yuan2.tcdn.qq.com. A 124.228.42.48, p31yuan2.tcdn.qq.com. A 183.60.217.54, p31yuan2.tcdn.qq.com. A 183.61.180.57, p31yuan2.tcdn.qq.com. A 220.169.154.184, p31yuan2.tcdn.qq.com. A 222.73.132.183, p31yuan2.tcdn.qq.com. A 61.155.220.182, p31yuan2.tcdn.qq.com. A 113.17.185.185, p31yuan2.tcdn.qq.com. A 113.17.185.186, p31yuan2.tcdn.qq.com. A 113.105.73.195, p31yuan2.tcdn.qq.com. A 113.108.88.62, p31yuan2.tcdn.qq.com. A 117.21.185.46, p31yuan2.tcdn.qq.com. A 117.21.185.47, p31yuan2.tcdn.qq.com. A 119.97.181.53, p31yuan2.tcdn.qq.com. A 119.147.254.54 (464)
439        m.qpic.cn. A 14.17.32.221, m.qpic.cn. A 14.17.42.35, m.qpic.cn. A 14.17.52.151, m.qpic.cn. A 14.17.52.152, m.qpic.cn. A 113.108.16.32, m.qpic.cn. A 183.60.72.29, m.qpic.cn. A 183.60.72.40, m.qpic.cn. A 183.60.72.44, m.qpic.cn. A 183.60.72.45, m.qpic.cn. A 183.61.38.164, m.qpic.cn. A 183.61.38.192, m.qpic.cn. A 183.61.38.193, m.qpic.cn. A 183.61.38.200, m.qpic.cn. A 183.61.38.201, m.qpic.cn. A 183.61.38.202, m.qpic.cn. A 183.61.49.160 (397)
87        free.worldweatheronline.com. (45)
74        dm.toutiao.com. (32)
357        dm.toutiao.com. CNAME i.snssdk.com., i.snssdk.com. CNAME snssdk.com., snssdk.com. A 60.29.248.125, snssdk.com. A 60.29.248.126, snssdk.com. A 60.29.248.123, snssdk.com. A 60.29.248.124 (315)
79        ichannel.snssdk.com. (37)
152        wap.xjoys.com. A 221.130.5.24 (110)
355        ichannel.snssdk.com. CNAME i.snssdk.com., i.snssdk.com. CNAME snssdk.com., snssdk.com. A 60.29.248.124, snssdk.com. A 60.29.248.125, snssdk.com. A 60.29.248.126, snssdk.com. A 60.29.248.123 (313)
506        3gimg.qq.com. CNAME p31yuan2.tc.qq.com., p31yuan2.tc.qq.com. CNAME p31yuan2.tcdn.qq.com., p31yuan2.tcdn.qq.com. A 119.147.254.54, p31yuan2.tcdn.qq.com. A 122.228.70.183, p31yuan2.tcdn.qq.com. A 124.228.42.47, p31yuan2.tcdn.qq.com. A 124.228.42.48, p31yuan2.tcdn.qq.com. A 183.60.217.54, p31yuan2.tcdn.qq.com. A 183.61.180.57, p31yuan2.tcdn.qq.com. A 220.169.154.184, p31yuan2.tcdn.qq.com. A 222.73.132.183, p31yuan2.tcdn.qq.com. A 61.155.220.182, p31yuan2.tcdn.qq.com. A 113.17.185.185, p31yuan2.tcdn.qq.com. A 113.17.185.186, p31yuan2.tcdn.qq.com. A 113.105.73.195, p31yuan2.tcdn.qq.com. A 113.108.88.62, p31yuan2.tcdn.qq.com. A 117.21.185.46, p31yuan2.tcdn.qq.com. A 117.21.185.47, p31yuan2.tcdn.qq.com. A 119.97.181.53 (464)

demo.zip

22.34 KB, 下载次数: 4

论坛徽章:
32
处女座
日期:2013-11-20 23:41:20双子座
日期:2014-06-11 17:20:43戌狗
日期:2014-06-16 11:05:00处女座
日期:2014-07-22 17:30:47狮子座
日期:2014-07-28 15:38:17金牛座
日期:2014-08-05 16:34:01亥猪
日期:2014-08-18 13:34:25白羊座
日期:2014-09-02 15:03:55金牛座
日期:2014-11-10 10:23:58处女座
日期:2014-12-02 09:17:52程序设计版块每日发帖之星
日期:2015-06-16 22:20:002015亚冠之塔什干火车头
日期:2015-06-20 23:28:22
发表于 2014-05-22 23:59 |显示全部楼层
这正则,啧啧啧,佩服楼主~{:2_172:}

论坛徽章:
1
金牛座
日期:2014-03-21 18:22:34
发表于 2014-05-23 08:53 |显示全部楼层
回复 2# yestreenstars


    大牛,你有什么好方法吗?我钻到胡同里了,暂时没想到用其他方法

论坛徽章:
32
处女座
日期:2013-11-20 23:41:20双子座
日期:2014-06-11 17:20:43戌狗
日期:2014-06-16 11:05:00处女座
日期:2014-07-22 17:30:47狮子座
日期:2014-07-28 15:38:17金牛座
日期:2014-08-05 16:34:01亥猪
日期:2014-08-18 13:34:25白羊座
日期:2014-09-02 15:03:55金牛座
日期:2014-11-10 10:23:58处女座
日期:2014-12-02 09:17:52程序设计版块每日发帖之星
日期:2015-06-16 22:20:002015亚冠之塔什干火车头
日期:2015-06-20 23:28:22
发表于 2014-05-23 08:59 |显示全部楼层
回复 3# lockeyou
面对你这一大堆数据,无从下手,抱歉~{:2_172:}

   

论坛徽章:
1
金牛座
日期:2014-03-21 18:22:34
发表于 2014-05-23 09:15 |显示全部楼层
本帖最后由 lockeyou 于 2014-05-23 09:15 编辑

# rubyish
大牛求解,求分析
就是拿出含A的前面余名以及后面解析地址

论坛徽章:
0
发表于 2014-05-23 10:08 |显示全部楼层
我假设每一行A前面的域名都是一样的,而且每一个A后面的ip地址都是想要的,你可以试下这个,截取部分你的文本内容,测试有效。
就是不知道效率怎样...
  1. #!/grid/common/pkgs/perl/v5.8.0/bin/perl -w

  2. use strict;

  3. mkdir "log";

  4. open (INPUT,    '<',"$ARGV[0]"   ) or die $!;
  5. open (OUTPUTA,  '>',"log/A.log"  ) or die $!;
  6. open (OUTPUTNOA,'>',"log/noA.log") or die $!;

  7. my @matched;

  8. while (<INPUT>) {
  9.     if (!($_ =~ /\ A\ /)) {
  10.         print OUTPUTNOA $_;
  11.     } else {
  12.            $_ =~ /([^\ ]*.)\.\ A/;
  13.            print OUTPUTA "$1  ";
  14.            @matched = $_ =~ /\ A\ ([^\&\( ]*.)/g;
  15.            print OUTPUTA "@matched\n";
  16.     }   
  17. }

  18. close INPUT;
  19. close OUTPUTA;
  20. close OUTPUTNOA;
复制代码

论坛徽章:
1
金牛座
日期:2014-03-21 18:22:34
发表于 2014-05-23 10:11 |显示全部楼层
感谢大牛解析,亲测ok,效率也很好,太感谢了
回复 6# b4and5


   

论坛徽章:
0
发表于 2014-05-23 10:15 |显示全部楼层
回复 7# lockeyou


    {:3_201:}  不是大牛.....新手新手.....

论坛徽章:
1
金牛座
日期:2014-03-21 18:22:34
发表于 2014-05-23 10:26 |显示全部楼层
擦,我要学会你的 这一块,  @matched = $_ =~ /\ A\ ([^\&\( ]*.)/g;
好厉害
我写得一个一个匹配,结果就是效率太慢了,而且有误伤
回复 8# b4and5


   
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

DTCC2020中国数据库技术大会

【架构革新 高效可控】2020年12月21日-23日第十一届中国数据库技术大会将在北京隆重召开。

大会设置2大主会场,20+技术专场,将邀请超百位行业专家,重点围绕数据架构、AI与大数据、传统企业数据库实践和国产开源数据库等内容展开分享和探讨,为广大数据领域从业人士提供一场年度盛会和交流平台。

http://dtcc.it168.com


大会官网>>
  

北京盛拓优讯信息技术有限公司. 版权所有 16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122
中国互联网协会会员  联系我们:huangweiwei@it168.com
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP