search日志查找唯一的电子邮件

我想search我的日志文件,只显示前面有“MAIL FORM:”的唯一的电子邮件地址

例如,如果我search,也许我有这些命中:

Mon 2014-03-17 00:01:38: <-- MAIL FROM:<[email protected]> Mon 2014-03-17 00:01:38: [email protected] is an alias for [email protected] Mon 2014-03-17 00:01:38: --> 250 <[email protected]>, Sender ok Mon 2014-03-17 00:01:38: <-- RCPT TO:<[email protected]> Mon 2014-03-17 00:01:38: --> 250 <[email protected]>, Recipient ok Mon 2014-03-17 00:01:38: <-- RCPT TO:<[email protected]> Mon 2014-03-17 00:01:38: --> 250 <[email protected]>, Recipient ok Mon 2014-03-17 00:01:39: <-- MAIL FROM:<[email protected]> Mon 2014-03-17 00:01:39: [email protected] is an alias for [email protected] Mon 2014-03-17 00:01:39: --> 250 <[email protected]>, Sender ok Mon 2014-03-17 00:01:39: <-- RCPT TO:<[email protected]> Mon 2014-03-17 00:01:39: --> 250 <[email protected]>, Recipient ok Mon 2014-03-17 00:01:39: <-- RCPT TO:<[email protected]> Mon 2014-03-17 00:01:39: --> 250 <[email protected]>, Recipient ok 

[email protected][email protected]可能在文件中有数百个条目。

你可以在Widnows上推荐一个简单的工具吗?

 sed -e 's/\(^.*<\)\(.*\)\(>.*$\)/\2/' yourfile.txt | sort |uniq 

它的Unix例子,但你可以得到该命令行的utils

sed http://gnuwin32.sourceforge.net/packages/sed.htm

sorting和uniq http://gnuwin32.sourceforge.net/packages/coreutils.htm

就我个人而言,我是JGSoft PowerGrep的粉丝(我是一个用户,而不是附属的)。 您可以select将相同的匹配分组。 你可以下载一个试用版,但在我看来这是非常值得的钱。