Email Address Parsing
Parsing out email addresses is a tedious task. This task hits my desk on a consistent basis. Usually, in my case, the list is coming out of Outlook. If the target list is coming out of Outlook make sure you export using Tab Separated for DOS (thus, click on File-->Import/Export–>Export to a File-->Tab Separated (DOS)-->[select_the_target_folder[). Take this target file and execute this command:
1
cat [filename] | grep -o -P "[[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.(local|aero|coop|info|museum|name|([0-9]{ 1,3})|([a-zA-Z]{2,3}))]*"
Alternatively I usually need a list of unique addresses:
1
cat [filename] | grep -o -P "[[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.(local|aero|coop|info|museum|name|([0-9]{ 1,3})|([a-zA-Z]{2,3}))]*" | sort -u
This post is licensed under CC BY 4.0 by the author.