pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <pgman@candle.pha.pa.us>
To: herve@elma.fr
Cc: pgsql-sql@postgresql.org
Subject: Re: Order by email address by domain ?
Date: Thu, 10 May 2001 15:47:57 -0400 (EDT)
Message-ID: <200105101947.f4AJlwe26570@candle.pha.pa.us> (raw)
In-Reply-To: <3AFADFFD.E6EF7225@elma.fr>

[ 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.com
	x@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, Pennsylvania 19026



view thread (6+ messages)  latest in thread

Message-ID: <200105101947.f4AJlwe26570@candle.pha.pa.us>
Permalink:  ../200105101947.f4AJlwe26570@candle.pha.pa.us/
Also on:    postgresql.org/message-id/200105101947.f4AJlwe26570@candle.pha.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: pgman@candle.pha.pa.us, herve@elma.fr
  Subject: Re: Order by email address by domain ?
  In-Reply-To: <200105101947.f4AJlwe26570@candle.pha.pa.us>
  References: <3AFADFFD.E6EF7225@elma.fr> <200105101947.f4AJlwe26570@candle.pha.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox