Script / parse issue

Joao Ferreira gmail joao.miguel.c.ferreira at gmail.com
Thu Oct 28 08:55:33 UTC 2010


use perl;

jmf


On Wed, 2010-10-27 at 17:35 -0700, P Echo wrote:
> Greetings all.  I am trying to write a script to extract email
> addresses from several lists.  Here is the problem:
> 
> List 1 contains member names in five groups, but no email addresses.
> I will manually break this list into five sublists.
> 
> List 2 has complete address information for all five groups, but it is
> alphabetical.
> 
> What I need to do is use the names in a sublist to search for the
> block of text in list 2 and extract the email address.
> 
> List 1 is a listing of members and the date they will be removed from
> the list "Exp'"  formatted like this:
> 
> Fname M. Last Exp. 1/2/12
> Jane Smith Exp.  3/5/11
> John Q Public Exp. 4/5/13
> Too Many Names Jones Exp. 6/5/12
> 
> The number of fields changes depending on person, but the "last name"
> is always the word before the "Exp."  But I don't know how to extract
> that part.  I'm also not sure if the full name will be rendered
> exactly the same in the two lists (It might be possible to just cut
> the Exp to the end, but not sure.
> 
> List 2 is formatted:
> 
> Name
> Company
> Address 1
> Address 2
> City State zip
> Phone
> Fax
> Email
> 
> Not everyone has a company listed or an Address 2 or Fax.  So they can
> have anywhere from 5 to 8 lines.  I had thought of extracting the name
> from list 1 as $name and then doing this:  grep -A 8 $name list2 |
> grep @
> 
> I have not tried it yet. I'm at my work computer (windows) and not
> able to work on this for a couple of hours.  Then when I can I need
> the result at 8:00 am.  <sigh>  If anyone can suggest anything, I'd be
> grateful.  I'm not averse to doing my own homework, so I'd be grateful
> for a RTFM, but which FM would be appreciated !
> 
> Thanks,
> 
> -- PE
> 






More information about the ubuntu-users mailing list