我想搜索我的日志文件并仅显示以“邮件表格:”开头的唯一电子邮件地址
例如,如果我搜索,可能会得到以下结果:
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
两个都[电子邮件保护]和[电子邮件保护]该文件中可能有数百个条目。
您能推荐一个 Widnows 上用于此目的的简单工具吗?
答案1
sed -e 's/\(^.*<\)\(.*\)\(>.*$\)/\2/' yourfile.txt | sort |uniq
这是 unix 示例,但你可以获取适用于 Windows 命令行的实用程序
sed http://gnuwin32.sourceforge.net/packages/sed.htm
排序和唯一 http://gnuwin32.sourceforge.net/packages/coreutils.htm
答案2
就我个人而言,我很喜欢强力Grep来自 JGSoft(我是用户,没有附属关系)。您可以选择将相同匹配分组。您可以下载试用版,但我认为它物有所值。