RE: [Nolug] Sorting lists of domains

From: J. Kent Busbee, Jr. <buz_at_penwel.com>
Date: Thu, 19 Jun 2003 13:13:50 -0500
Message-ID: <001101c3368e$88f96ed0$3204a8c0@penwel.com>

> 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.
>

Ok... Try this one for up to 4 subdomains where t1 is the unsorted file

awk -F. '{if (NF==1) x = "...."; if (NF==2) x = "..."; \
          if (NF==3) x = ".."; if (NF==4) x = "."; \
          if (NF==5) x = ""; print x $0}' t1 \
 | sort -f. -k 5,5 -k 4,4 -k 3,3 -k 2,2

___________________
Nolug mailing list
nolug@nolug.org
Received on 06/19/03

This archive was generated by hypermail 2.2.0 : 12/19/08 EST