【发布时间】:2015-05-19 14:39:20
【问题描述】:
从下面的数据中,我想知道有多少唯一的“Over quota”行对应于每行开头的 ID 值(例如 38148141CEB*),每个 ID 应该只即使有多个“超额”行,也只计算一次。哪种数据结构最适合用于此任务?如何转换数据以实现这一目标?
示例输入
38148141CEB* 55166 Tue May 19 20:38:45 aaa@bbb.com
aaa@nwegweg.com
AABFF141D0F* 6289 Tue May 19 20:38:44 MAILER-DAEMON
rgerg@rgerger.com
3F384141CAF* 15422 Tue May 19 20:38:44 MAILER-DAEMON
gregrg@gserhweh.com
6E5F1142129 59842 Tue May 19 17:22:39 rhgregr@grehedh.in
(connect to mail.rtherh.com.hk[118.142.113.41]:25: Connection timed out)
hbed@herer.com.hk
64ACF141E4D 7026 Tue May 19 14:21:14 hdtjndtrj@tjrftjnrf.com
(host hergherhe.herherh.com[172.16.12.160] said: 452 4.2.2 Over quota (in reply to end of DATA command))
c@rhedhed.com
(host hergherhe.herherh.com[172.16.12.160] said: 452 4.2.2 Over quota (in reply to end of DATA command))
c@rhedhed.com
67E1A1420CF 2993 Tue May 19 12:36:45 erhejhe
(host z.rherh.com[172.16.12.164] said: 452 4.2.2 Over quota (in reply to end of DATA command))
heehedh88@drehnjedthnj.com
(host hergherhe.herherh.com[172.16.12.160] said: 452 4.2.2 Over quota (in reply to end of DATA command))
c@rhedhed.com
680911418C9 11041 Tue May 19 13:59:49 efswegrwe
(host zgewsegws.nrhsrhedr.com[172.16.12.161] said: 452 4.2.2 Over quota (in reply to end of DATA command))
wrhwrg@etheherg.com
666611416DD 29459 Tue May 19 11:35:58 erherhe@ejerthjrth.com
(host herer.herwsrh.com[172.16.12.152] said: 452 4.2.2 Over quota (in reply to end of DATA command))
rggerhed@erhjehjedtr.com
(host hergherhe.herherh.com[172.16.12.160] said: 452 4.2.2 Over quota (in reply to end of DATA command))
c@rhedhed.com
(host hergherhe.herherh.com[172.16.12.160] said: 452 4.2.2 Over quota (in reply to end of DATA command))
c@rhedhed.com
643F9142006 11077 Tue May 19 11:34:32 tejeastj@eherjhe.com
(Host or domain name not found. Name service error for name=tjedtjedt.com type=MX: Host not found, try again)
tedjedth@edtjedthghr.com
62980141A8C 464040 Tue May 19 15:52:06 etjertj@jrtjedtj.com.hk
(host zherherh.com[172.16.12.159] said: 452 4.2.2 Over quota (in reply to end of DATA command))
trjerjer@rherherh.com
6DD47142017 20049 Tue May 19 11:04:34 erhedrhje
(host ejedtjedrth.com[172.16.12.161] said: 452 4.2.2 Over quota (in reply to end of DATA command))
ehjdthjdr@etjtdfteh.com
696AD1420A4 7679 Tue May 19 15:09:05 wrgwsrg
(host rwherhe.hre.com[172.16.12.157] said: 452 4.2.2 Over quota (in reply to end of DATA command))
wegw@gwrhbwrg.com
样本输出
我需要的输出如下所示:
7 Over quota:
64ACF141E4D, 67E1A1420CF, 680911418C9, 666611416DD, 62980141A8C, 6DD47142017, 696AD1420A4
【问题讨论】:
-
您是否尝试过解决此问题?如果有,请出示。
-
嗨。 Stack Overflow 是一个帮助人们解决编程问题的网站。这不是编码服务。这些是存在的,但通常它们要花钱。如果您需要有关编码问题的帮助,我建议您查看How to Ask 并相应地重新起草您的问题。
-
你没有甚至分享这个“配额”的价值是什么。
-
哎呀...我有点像
push @over我猜:-P @mak-on-in ...如果您想继续成为 Stackoverflow 的一部分,您应该尝试改善你的问题;更清楚地制定您的要求;有一个清晰且相关的标题/主题,将您的问题与一些通用编程问题/技术联系起来;并至少尝试来解决它(在这种情况下使用 perl)。
标签: perl data-structures perl-data-structures