Received: from candle.pha.pa.us (candle.navpoint.com [162.33.245.46]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f4AJm3A32181 for ; Thu, 10 May 2001 15:48:03 -0400 (EDT) (envelope-from pgman@candle.pha.pa.us) Received: (from pgman@localhost) by candle.pha.pa.us (8.10.1/8.10.1) id f4AJlwe26570; Thu, 10 May 2001 15:47:58 -0400 (EDT) From: Bruce Momjian Message-Id: <200105101947.f4AJlwe26570@candle.pha.pa.us> Subject: Re: Order by email address by domain ? In-Reply-To: <3AFADFFD.E6EF7225@elma.fr> =?ISO-8859-1?Q?from_Herv=E9_Piedvache_at_May_10=2C_2001_08=3A37=3A49_pm?= To: herve@elma.fr Date: Thu, 10 May 2001 15:47:57 -0400 (EDT) CC: pgsql-sql@postgresql.org X-Mailer: ELM [version 2.4ME+ PL90 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Archive-Number: 200105/77 X-Sequence-Number: 2878 [ 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