Email Address Parsing

- 10 Jul 2007

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:

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:

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


Related Posts: Extracting Smarty variables from source » Installing vzdump on CentOS 5.4 (32-bit) » Dumping Addresses from phplist » Adding NRPE (Nagios) to CentOS \/ RHEL Servers » Adding the REMI Repository to CentOS / RHEL / RedHat »

comments powered by Disqus