APPLDIR=/ran
DATADIR=/usr/ran
t=/tmp/t
t4=/tmp/t4
t5=/tmp/t5
export APPLDIR DATADIR APPL PATH
awk -F: ' BEGIN {
appl="'"$APPLDIR"'"
data="'"$DATADIR"'"
t4="'"$t4"'"
}
 NR >1 && $4+0 >39 { printf "%.2d:%s:%.2d:%s/%s/%s.t0:%s/%s/HEAD\n",$4,$8,$9,appl,$7,$7,data,$7 > t4
  if ($4+0 >49) printf "%s/%s/%s.t0\n",appl,$7,$7
} ' $t > $t5
links=`cat $t5`
awk -F: ' begin {
j=0
k=0
}
FILENAME==ARGV[1] {
x1[$4]=$1
x2[$4]=$2
x3[$4]=$3
x4[$4]=$5
x5[$4]=""
next }
{
	
	
	if( x5[FILENAME]=="")
	{
		l1[FILENAME] =$1*6
		x5[FILENAME]=" "
		next
	}
	if( $1==x2[FILENAME]) le[FILENAME]=l[FILENAME]
	l[FILENAME] +=$2
}
END { for (i in  x1 ) printf "%d:%s:%d:%d:%d\n",x1[i],x4[i],l[i]+l1[i],le[i],x3[i]
} ' $t4 $links


