#!/bin/sh
# 
# Join data from direct impact and strong dependencies
#
for f in *.bz2; do
 fn=`basename $f .bz2`
 if [ -f $fn.direct-impact ]; then
  if [ -f $fn.strongdeps ]; then
   sort $fn.direct-impact > /tmp/a.$$
   sort $fn.strongdeps | sed "s/'.*[\t]/ /" > /tmp/b.$$
   echo "Package	Direct	Strong	D-S	D/S*100" > $fn.sensitive-vs-direct-impact
   join /tmp/a.$$ /tmp/b.$$ | awk '{print $1 " " $2 " " $3 " " $2-$3 " " ($3!=0 ? $2/$3*100 : 0) "%"}' >> $fn.sensitive-vs-direct-impact
  fi
 fi
done
rm /tmp/a.$$ /tmp/b.$$

