EasyCoding Short Tutorial: Extract E-Mail addresses from a textfile

in #email7 years ago

Have you ever had the problem that you have a big text file full with user data, but needed only the emails but couldn't extract them quickly?

I definitely did. So I created an easy method to extract all user emails from a textfile.

Open up your console and type/paste the following command:

grep -o '[[:alnum:]+._-]@[[:alnum:]+._-]' FILE.TXT | sort | uniq -i >> Emails.txt

Make sure to replace the FILE.TXT with the name of your text file. You can change the output file by simply changing the filename at the end of the command.

This command will grab all lines in the file which could be an email and put them into another file called "Emails.txt".
No email will ever be listed two times.
You should quickly skim over the output file though since there can be slight mistakes.

Any questions? Leave a comment!

Happy coding!
-PrivateGER

Sort:  

Congratulations @privateger! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 1 year!

Click here to view your Board

Support SteemitBoard's project! Vote for its witness and get one more award!

Congratulations @privateger! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!