List


This program takes a list similar to the below

johnie   bael.umd.umi:ttyq0    Nov 25 11:24       3 (199.178.102.21)
chrisbib bael.umd.umi:console  Nov 25 12:13         (:0)
stoneman null.umd.umi:ttyp5    Nov 25 12:18       5 (pc59.cw.umd.umic)
srbledso null.umd.umi:ttyq4    Nov 25 13:00       2 (pm047-aa.mich.ne)
phurley  surma.umd.um:ttyp3    Nov 25 12:56       3 (204.39.2.89)
marcyb   surma.umd.um:ttyp6    Nov 25 07:59         (pm002-18.dialip.)
nikkirae ishtar.umd.u:ttyq9    Nov 25 12:55         (141.215.24.31)

And produces:

bael 
 	 - 	 chrisbib
	 5 	 johnie
ishtar
- nikkirae null 4 srbledso 6 stoneman surma - marcyb 5 phurley

This is the source code:


nawk  '{print $1,$6,$2}' | 
sed 's/(.*)/-/' |
nawk -F . '{print $1}' | 
nawk '{print $3,$1,$2}' | sort |
nawk '{
	if ((Lastname!=$2) || (Lastmachine!=$1)) {
		Lastname=$2
		if ($1!=Lastmachine) {
			Lastmachine = $1
			print $1,"\n","\t",$3,"\t",$2
			}
		else { print "\t",$3,"\t",$2 }
	}
}
' $*