sorting (using sort/sed/awk/whatever)

Jon H. LaBadie jon at jonlab.UUCP
Sat Aug 11 17:19:22 AEST 1990


In article <13492 at smoke.BRL.MIL>, gwyn at smoke.BRL.MIL (Doug Gwyn) writes:
> In article <MONTNARO.90Aug5102632 at spyder.crd.ge.com> montanaro at crdgw1.ge.com (Skip Montanaro) writes:
> >In article <13485 at smoke.BRL.MIL> gwyn at 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



More information about the Comp.unix.questions mailing list