Remove everything except characters between '<' & '>,' in Vim — extract email addresses from Gmail “To” field

℡╲_俬逩灬. 提交于 2019-12-02 01:57:11

Have you tried?

:s/.\{-}\%(\(,\s*\)\|<\(.\{-}\)>\)/\1\2/g

The following will also work:

:s/.*/\=join(map(split(submatch(0), ','), "matchstr(v:val, '<\\zs.*\\ze>')"), ', ')

with awk

    echo "Fred Flintstone <fred@flintstone.org>, Wilma Flintstone <wilma@flintstone.org>, Barney Rubble <barney@rubble.org>, Bamm-Bamm Rubble <bammbamm@rubble.org>
"|awk -F'<|>' '{for (i=1;i<=NF;i++)printf (i%2==0)?$i",":""}'

or in VIM

:%s/,/\r/g
:%s/.*<\(.*\)>/\1/g

Could you not put it into Excel, then split the data on the comma and then and then do a find and replace to get rid of the angel bracket

Unless you are using some code to do it this would be the easiest unless you have 100,000's of thousand addresses

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!