 BASE=`pwd`
APPLDIR=$BASE/appl
DATADIR=$BASE/data
PATH=$PATH:$BASE/ihd/bin:.
export PATH APPLDIR DATADIR
$APPLDIR/sh/newform $1 | 

awk -F^ ' $12!="H" && $12!="D" { next }
function trail(txt) { while (substr(txt,length(txt),1)==" ") txt=substr(txt,1,length(txt)-1); return (txt) }
trail($20)!="" {
 #print $1"^"trail($2)
 print trail($20)
} '  | 
sort -u >tmp/l2f
sort -u tmp/l1f -o tmp/l1f
#sort tmp/l*f | awk -F^ ' $2!="" { print } ' 
cat tmp/l2f | while read line
do
echo $line ----
awk -F: ' NR>1 { print "'"$line"'^"NR-1"^"$1 }
END { print "'"$line"'",NR
} ' appl/$line/$line.t0
echo =======================
done


