on Thu, Jun 12, 2003 at 12:27:15AM -0400, Chun Kit Edwin Lau (try_email_me@yahoo.ca) wrote:
> On June 11, 2003 11:14 pm, Karsten M. Self wrote:
> > on Wed, Jun 11, 2003 at 05:15:32PM -0400, Chun Kit Edwin Lau
> (try_email_me@yahoo.ca) wrote:
> > > Hi everyone,
> > >
> > > I am writing some shell script (bash) to read from
> > > Addresses.pdb and convert it to mutt address using lbdbq. I
> > > encounter a problem where some ppl have two or even 3 emails
> > > which I have to come out with a unique alias in mutt. How do I
> > > put a number in the alias name automatically to make it unique.
> > > So far I have
> > >
> > > MUTT_ADDRESSES=~/.mutt/mutt.addresses
> > > ADDRESSES_PDB=~/AddressDB.pdb
> > >
> > > lbdbq | sed '1 d' |
> > > sed
> > > 's/^\([A-Za-z0-9_-.]*@[A-Za-z0-9_-.]*\)\t\([A-Za-z0-9_-.]*\)[
> > > ]*\([A-Za-z0-9_-. ]*\)\t(Palm)/alias \2 "\2 \3" <\1>/' | sort >
> > > $MUTT_ADDRESSES
> >
> > ^
> > -u
>
> The email address are unique, but not the alias name. I need to
> append a different number to each repeating alias name to make it
> unique. for example,
>
> alias Joe "Joe Joe" <joe@joejoe.com>
> alias Joe "Joe Joe" <joejoe@joejoe.com>
>
> become
>
> alias Joe1 "Joe Joe" <joe@joejoe.com>
> alias Joe2 "Joe Joe" <joejoe@joejoe.com>
Explaining your problem clearly helps.
Using a hash (associative array) in awk or perl could get you past this.
You'd test whether or not the value of mail{'Joe'} was null and/or
equal to your current address value. If not, then create mail{'Joe2'}.
Syntax varies with implementation.
Peace.
--
Karsten M. Self <kmself@ix.netcom.com> http://kmself.home.netcom.com/
What Part of "Gestalt" don't you understand?
Moderator, Free Software Law Discussion mailing list:
http://lists.alt.org/mailman/listinfo/fsl-discuss/
Attachment:
pgpzcc_XK16s4.pgp
Description: PGP signature