#!/bin/sh
if test $# -eq 0
then
	echo "usage: $0 [<filename>]";
	exit 1;
fi

if test "x$UGROOT" = "x"
then 
	echo "$0: to use $0 set shell environment variable UGROOT!";
	exit 1;
fi

case `/bin/uname` in
    HP-UX)
        AWK=awk
        ;;
    *)
        AWK=nawk
        ;;
esac;

# set path to bin dir
BINPATH=$UGROOT/bin

# extract relevant info
# this done using a pipe with filters and sorters
# cat files matching $1* to stout
cat $1.[0-9]* | \
\
# get interesting lines
grep IdentObjectHdr | \
\
# remove pvm output prefix
sed 's/^\[.*\][ ]*//' | \
\
# remove processor number
sed 's/^[0-9]*:[ ]*//' | \
\
# sort lines 
sort | \
# sort IdentHdr and ProcList fields and write to file
$AWK -f $BINPATH/ugckid.awk - > $1.id

