extract email adresses from some file (or any other pattern)

grep -aEio '([[:alnum:]_.-\+\-]+@[[:alnum:]_.-]+?\.[[:alpha:].]{2,6})'
This will catch most separators in the section of the email: dot . dash - underscore _ plus + (added for gmail) ... and the basic dash '-' of host names.
Sample Output

2013-06-23 21:52:14

4 Alternatives + Submit Alt

What Others Think

I am glad to visit this site. Whenever I visit this site I got great information from here Keep working like this. Regards, Shaikh best assignment help websites
Shiakh_sahab · 74 weeks and 2 days ago
Hey guys. Thanks a lot for such a cool discussion. You gave me food for thought. Proceed to site https://essayslab.com/constipation-care-plan.html You will find hundreds of quality educational guidelines here.
kellyrise · 58 weeks and 3 days ago
Ok, let me explain this one. Yesterday I was doing some stuff trying to collect email addresses from a large list. I can say that handyman services and get more tips about paints. So I start thinking about how to do this in an automated way without having to do it by hand. So, the first thing that came to my mind is: I've got to start a project. And thus, this article was born. The problem you want to solve: You want to extract email addresses from a file (or any other pattern).
Schmidt00014 · 13 weeks and 6 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: