bottom post^^^^^^^^^^^^^ sed可以匹配,关键是怎么输出邮件地址,sed匹配后,默认的输入是一整行。
一个办法是直接用grep命令,它有一个参数-o echo 'From: xxx yyy <[email protected]>' | grep -o '正则表达式' On 五, 2010-06-18 at 18:33 +0800, Ray Wang wrote: > (<)?(\...@\w+(?:\.\w+)+)(?(1)>) > > 这个表达式在python 中可以工作,但我在sed 没有试通,也许你试用perl 看看 > > 2010/6/18 listofx <[email protected]>: > > 通常,邮件头中发件人有如下格式 > > From: xxx yyy <[email protected]> > > From: “xxx yyy” <[email protected]> > > From: [email protected] > > > > 我想提取这样一行中的地址(只是[email protected]),该如何进行? > > > > 我知道:如果不考虑第三种情况,采用<字符作为字段分隔符,使用cut或者awk就 > > 很容易得到结果。 > > > > sed能做到吗? > > 在发邮件的时候,我想到一个办法,还是想看看是否有别的方式。 > > > > -- ubuntu-zh mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-zh
