Ah, but does this work for an arbitrary number of subdomains? That's the
tricky one. I know that my solution is cumbersome. I'd like to see one that
handles an arbitrary number of subdomains, but is cleaner than mine. I know
it can be done.
At 10:50 AM 6/19/2003 -0500, you wrote:
>Left out the t1 right before the pipe to sort
>
>awk -F. '{if (NF==2) x = "."; if (NF==3) x = ""; print x $0}' t1 \
> | sort -f. -k 3,3 -k 2,2
>
>
> > -----Original Message-----
> > From: J. Kent Busbee, Jr. [mailto:buz@penwel.com]
> > Sent: Thursday, June 19, 2003 10:48 AM
> > To: 'nolug@joeykelly.net'
> > Subject: RE: [Nolug] Sorting lists of domains
> >
> >
> > Here is another solution:
> >
> > Assume t1 is your list
> >
> > awk -F. '{if (NF==2) x = "."; if (NF==3) x = ""; print x $0}'
> > | sort -f. -k 3,3 -k 2,2
> >
> > > -----Original Message-----
> > > From: owner-nolug@joeykelly.net
> > > [mailto:owner-nolug@joeykelly.net] On Behalf Of mrobinso@fpkc.com
> > > Sent: Wednesday, June 18, 2003 1:38 PM
> > > To: nolug@joeykelly.net
> > > Cc: mrobinso@fpkc.com
> > > Subject: [Nolug] Sorting lists of domains
> > >
> > >
> > > The list has been a little quiet (down ?) for a couple of
> > > days, so here's an easy question.
> > >
> > > I'm looking for a utility - Linux or otherwise - to take a
> > > list of domains or even email
> > > addresses and sort them from the TLD down. In other words,
> > > treating periods as field
> > > delimiters and sorting fields from right to left. So, for example:
> > >
> > > h.net
> > > 3.e.edu
> > > c.mil
> > > d.com
> > > 1.a.com
> > > 4.f.net
> > > g.uk
> > > 2.b.gov
> > > 5.a.com
> > >
> > > would sort to
> > >
> > > 1.a.com
> > > 5.a.com
> > > d.com
> > > 3.e.edu
> > > 2.b.gov
> > > c.mil
> > > 4.f.net
> > > h.net
> > > g.uk
> > >
> > > Someone must have made a tool to do this, but I can't find
> > > one. I could probably cobble
> > > something together in Perl, but I don't want to reinvent the
> > > wheel. All I get from
> > > web searches are mailing list programs and domain
> > registration tools.
> > >
> > > Thanks.
> > >
> > >
> > > Mark Robinson
> > >
> > > ___________________
> > > Nolug mailing list
> > > nolug@nolug.org
> > >
> >
>
>___________________
>Nolug mailing list
>nolug@nolug.org
--- Dustin Puryear <dustin@puryear-it.com> Puryear Information Technology Windows, UNIX, and IT Consulting http://www.puryear-it.com ___________________ Nolug mailing list nolug@nolug.orgReceived on 06/19/03
This archive was generated by hypermail 2.2.0 : 12/19/08 EST