Re: Order by email address by domain ? - Mailing list pgsql-sql

From Bruce Momjian
Subject Re: Order by email address by domain ?
Date
Msg-id 200105101947.f4AJlwe26570@candle.pha.pa.us
Whole thread Raw
In response to Order by email address by domain ?  (Hervé Piedvache <herve@elma.fr>)
List pgsql-sql
[ Charset ISO-8859-1 unsupported, converting... ]
> Hi,
> 
> I just want to order by a listing of email address by domain like :
> 
> toto@aol.com
> tutu@aol.com
> toto@be.com
> tutu@be.com
> toto@yahoo.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@bc.comx@ad.com

ad is after ac because the sorting is done on moc.cb@x and moc.da@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@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


pgsql-sql by date:

Previous
From: Hervé Piedvache
Date:
Subject: Order by email address by domain ?
Next
From: "Josh Berkus"
Date:
Subject: Re: Order by email address