Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.misc > #11768

Re: Script to parse a text file and extract unique email addresses

From Andreas Kohlbach <aug14.8.ankman@spamgourmet.com>
Newsgroups comp.os.linux.misc
Subject Re: Script to parse a text file and extract unique email addresses
Date 2014-08-20 18:26 -0400
Organization albasani.net
Message-ID <874mx6ol11.fsf@usenet.ankman.de> (permalink)
References <da031cdc-9a9e-444e-a951-13ad4fdf5b93@googlegroups.com> <87zjf0qklx.fsf@usenet.ankman.de> <lt27c5$gfj$1@news.albasani.net> <87f49cf7-724b-4235-b466-082dac8287e9@googlegroups.com>

Show all headers | View raw


nomdeplume82008@googlemail.com wrote on 20. August 2014:
>
> On Wednesday, August 20, 2014 1:21:09 PM UTC, The Natural Philosopher wrote:
>> On 19/08/14 21:40, Andreas Kohlbach wrote:
>> 
>> > wrote on 19. August 2014:
>> 
>> >>
>> 
>> >> My scripting is a v. rusty and I am trying to write a script that will extract unique email addresses from an out Outlook file to build an address book.
>> 
>> >>
>> 
>> >> In the output file, all the email addresses should preferably be in a single alphabetical column.
>> 
>> >>
>> 
>> >> Any suggestions on how to do it?
>> 
>> >
>> 
>> > Isn't the Outlook file something proprietary? You might need to get some
>> 
>> > plain text out of it first. Then some Perl or awk could extract the email
>> 
>> > addresses from it.
>> 
>> >
>> 
>> in general some kind of awk to select the column you want piped to sort 
>> 
>> -u to extract one instance of each duplicate.
>> 
>> Everything you read in newspapers is absolutely true, except for the 
>> 
>> rare story of which you happen to have first-hand knowledge. - Erwin Knoll
>
> Going by columns won't work, because the email might be one in a CC/BCC list. 
>
> I've checked the format of the emails, they are archived in the same manner as you would see if you read an email with its full headers. 
>
> It would be best to get the script to extract characters around a @ sign. All of them appear to be enclosed in a <> symbols.

Try

grep -E -o "\b[a-zA-Z0-9.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+\b"|sed -e 's/^//'

to extract from the file.
-- 
Andreas

I wish my grass was emo. Then it would cut itself.

Back to comp.os.linux.misc | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Script to parse a text file and extract unique email addresses nomdeplume82008@googlemail.com - 2014-08-19 10:19 -0700
  Re: Script to parse a text file and extract unique email addresses Andreas Kohlbach <aug14.8.ankman@spamgourmet.com> - 2014-08-19 16:40 -0400
    Re: Script to parse a text file and extract unique email addresses The Natural Philosopher <tnp@invalid.invalid> - 2014-08-20 14:21 +0100
      Re: Script to parse a text file and extract unique email addresses nomdeplume82008@googlemail.com - 2014-08-20 08:52 -0700
        Re: Script to parse a text file and extract unique email addresses Andreas Kohlbach <aug14.8.ankman@spamgourmet.com> - 2014-08-20 18:26 -0400
          Re: Script to parse a text file and extract unique email addresses nomdeplume82008@googlemail.com - 2014-08-20 21:10 -0700
            Re: Script to parse a text file and extract unique email addresses Andreas Kohlbach <aug14.8.ankman@spamgourmet.com> - 2014-08-21 18:07 -0400
          Re: Script to parse a text file and extract unique email addresses Tim Watts <tw_usenet@dionic.net> - 2014-08-21 10:53 +0100
            Re: Script to parse a text file and extract unique email addresses Andreas Kohlbach <aug14.8.ankman@spamgourmet.com> - 2014-08-21 18:03 -0400
        Re: Script to parse a text file and extract unique email addresses Bill Marcum <bill.marcum57@yahoo.com> - 2014-08-21 03:34 -0400
          Re: Script to parse a text file and extract unique email addresses The Natural Philosopher <tnp@invalid.invalid> - 2014-08-21 12:12 +0100
          Re: Script to parse a text file and extract unique email addresses Chris Davies <chris-usenet@roaima.co.uk> - 2014-08-21 12:12 +0100
            Re: Script to parse a text file and extract unique email addresses The Natural Philosopher <tnp@invalid.invalid> - 2014-08-21 14:22 +0100
              Write it in C... (Was: Script to parse a text file and extract unique email addresses) gazelle@shell.xmission.com (Kenny McCormack) - 2014-08-21 13:42 +0000
                Re: Write it in C... (Was: Script to parse a text file and extract unique email addresses) The Natural Philosopher <tnp@invalid.invalid> - 2014-08-21 15:23 +0100
                Re: Write it in C... Rich <rich@example.invalid> - 2014-08-21 16:17 +0000
                Re: Write it in C... The Natural Philosopher <tnp@invalid.invalid> - 2014-08-21 18:42 +0100
                Re: Write it in C... William Unruh <unruh@invalid.ca> - 2014-08-21 18:38 +0000
        Re: Script to parse a text file and extract unique email addresses Loki Harfagr <l0k1@thedarkdesign.free.fr.INVALID> - 2014-09-24 13:18 +0000
          Re: Script to parse a text file and extract unique email addresses Doug Laidlaw <laidlaws@hotkey.net.au> - 2014-09-25 01:49 +1000
            Re: Script to parse a text file and extract unique email addresses Loki Harfagr <l0k1@thedarkdesign.free.fr.INVALID> - 2014-09-25 09:34 +0000
  Re: Script to parse a text file and extract unique email addresses Mladen Gogala <gogala.mladen@gmail.com> - 2014-09-29 00:17 +0000
    Re: Script to parse a text file and extract unique email addresses Rich <rich@example.invalid> - 2014-09-29 00:52 +0000
      Re: Script to parse a text file and extract unique email addresses gazelle@shell.xmission.com (Kenny McCormack) - 2014-09-29 01:13 +0000
    Re: Script to parse a text file and extract unique email addresses Tim Watts <tw_usenet@dionic.net> - 2014-09-29 07:40 +0100
    Re: Script to parse a text file and extract unique email addresses Eric Pozharski <whynot@pozharski.name> - 2014-09-29 09:52 +0300

csiph-web