opt=$1
shift

case $opt in
-u) noet=`echo $4 | awk ' {printf"%04d",$1} '`
case $2 in
irv) cat $ENT/$2.ent ; zex $1 | grep $noet | awkze $3 | tee .T/e$noet.lst ;;
  *) cat $ENT/$2.ent ; zex $1 | grep $noet | awkze $3 ;;
esac ;;

-r) FS=$1 ; TY=$2 ; shift ; shift 
    (cat $ENT/$TY.ent | ind
    for i in $*
    do
      noet=`echo $i | awk ' {printf"%04d",$1} '`
      zex $FS | grep $noet | tee -a $REF
      echo ' '
    done | ind 
    cat $REF | awk '{printf "%10d\n",$2} ' | sort -o $BTP/ref.out -nu +0
    multiref )| more ;;

-sort)
col=`grep $2 $DIC/pos.dic | awk ' $1 == cle {print $4-1} ' cle=$3`
(cat $ENT/$2.ent ; zex $1 | sort -n +$col | tee $SRT ) | page ;;

-sortrv)
col=`grep $2 $DIC/pos.dic | awk ' $1 == cle {print $4-1} ' cle=$3`
(cat $ENT/$2.ent ; zex $1 | sort -r -n +$col | tee $SRT ) | page ;;

-id) 
pos=`grep idm $DIC/pos.dic | awk ' $1 == cle {print $2,$3} ' cle=$3`
TY=`grep idm $DIC/pos.dic | awk ' $1 == cle {print $8} ' cle=$3`
FS=`nof $TY`
echo $pos $TY 
noet=`zex $FS | awke $pos $4 2>/dev/null | awkprbl1`
cat $ENT/$2.ent ; zex $1 | grep $noet | tee $REF ;;

-f) (cat $ENT/$2.ent ; zex $1 | fgrep -f $3 | tee $SRT )| more ;;
esac
echo ' '
