Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!ames!haven!decuac!e2big.mko.dec.com!bacchus.pa.dec.com!decwrl!wuarchive!udel!princeton!jonlab!jon From: jon@jonlab.UUCP (Jon H. LaBadie) Newsgroups: comp.unix.questions Subject: Re: sorting (using sort/sed/awk/whatever) Summary: well, a slight alteration Message-ID: <849@jonlab.UUCP> Date: 11 Aug 90 07:19:22 GMT References: <2943@mtung.ATT.COM> <13485@smoke.BRL.MIL> <13492@smoke.BRL.MIL> Organization: 4455 Province Line Rd., Princeton, NJ 08540 Lines: 40 In article <13492@smoke.BRL.MIL>, gwyn@smoke.BRL.MIL (Doug Gwyn) writes: > In article montanaro@crdgw1.ge.com (Skip Montanaro) writes: > >In article <13485@smoke.BRL.MIL> gwyn@smoke.BRL.MIL (Doug Gwyn) writes: > > Surely you jest. You're asking for an artificial intelligence program here. > >I don't know. The following short shell script seems to do what Luke wanted > >(cluster all the C++ groups together, regardless of their spot in the Usenet > >tree). > > It only orders by the last member of the hierarchy, which is not very helpful > (as you can see by running a large .newsrc through this process). For example, > foo.c++.bugs would be collected with other *.bugs, not with other c++ groups. While I see little value in the original poster's desires, Doug's comment on Skip's solution is easily taken care of with out AI type code. To wit: cut -d: -f1 .newsrc | awk -F. ' { for (i = NF; i >= 1; i--) printf("%s ", $i) print "" }' | paste -d: - .newsrc | sort | cut -d: -f2- > puke And should you not have cut (a Xenix related deficiency) let me know and I'll provide an awk/shell script to mimic it. Or perhaps there is a ???.sources version around. Jon -- Jon LaBadie {att, princeton, bcr}!jonlab!jon {att, attmail, bcr}!auxnj!jon