uniquelabel 837 Bytes
#!/bin/sh

step=label
# outfile=${1%.u.dbg}.tvd.dbg
outfile=$1
#tmpfile=${1%.u.dbg}.tmp.dbg
tmpfile=`basename $1 .u.dbg`.tmp.dbg

/bin/rm -f $tmpfile 2> /dev/null


for lab in `cat $1`
do
    if [ $step = label ]
    then
	step=address
	label=$lab
    else if [ $step = address ]
    then
	step=i
	address=$lab
    else if [ $step = i ]
    then
	step=label
	echo "$address $label I" >> $tmpfile
    fi
    fi
    fi

done

/bin/rm -f $outfile 2> /dev/null
step=label

for lab in `cat $tmpfile | sort`
do
    if [ $step = label ]
    then
	step=address
	address=$lab
    else if [ $step = address ]
    then
	step=i
	label=$lab
    else if [ $step = i ]
    then
	step=label
	if [ $lastaddr != $address ]
	then
	    echo "$label $address I" >> $outfile
	fi
	lastaddr=$address
    fi
    fi
    fi

done

/bin/rm -f $tmpfile 2> /dev/null