Re: Order by email address by domain ?

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: herve(at)elma(dot)fr
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Order by email address by domain ?
Date: 2001-05-10 19:47:57
Message-ID: 200105101947.f4AJlwe26570@candle.pha.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-sql

[ Charset ISO-8859-1 unsupported, converting... ]
> Hi,
>
> I just want to order by a listing of email address by domain like :
>
> toto(at)aol(dot)com
> tutu(at)aol(dot)com
> toto(at)be(dot)com
> tutu(at)be(dot)com
> toto(at)yahoo(dot)com
>
> Is it possible and how ?

Good question. I have shell script I use to look for network duplicates
in my SPAM database so I can block even more networks. What I do is run
the program through 'rev' (on BSD/OS, not sure about other OS's) that
reverses the characters on every line, then run it though sort, the use
'rev' again to unreverse them. It groups duplicate hosts/networks
together, but does not order things properly:

x(at)bc(dot)com
x(at)ad(dot)com

ad is after ac because the sorting is done on moc(dot)cb(at)x and moc(dot)da(at)x, and
c is before d.

Not sure if that helps, but that I what I did. Not sure how to do that
in the database. Seems you will have to strip off the username@ part
and sort just the host name, then put it back.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2001-05-10 20:17:49 Re: Order by email address
Previous Message Hervé Piedvache 2001-05-10 18:37:49 Order by email address by domain ?