# This script counts duplicate packets
#  call:  ...$ adup file
#
echo ">>>> The file is named:" $1
echo "The period ends:"
tail -15 /db/jnos/trace/$1 | grep " vhf "
echo "The period begins:"
head -10 /db/jnos/trace/$1 | grep " vhf "
echo "The total UI packets."
grep -A4 -e "vhf recv" /db/jnos/trace/$1 \
  | grep -A2 -B2 -e " UI " \
  | grep -c "^TCP:" 
echo "The DUPLICATE UI packet counts by repeat number."
grep -A4 -e "vhf recv" /db/jnos/trace/$1 \
  | grep -A2 -B2 -e " UI " \
  | grep  "^TCP:" \
  | uniq -cd \
  | sort -n \
  | uniq -cd -w8 
echo "The total I packets."
grep -A4 -e "vhf recv" /db/jnos/trace/$1 \
  | grep -A2 -B2 -e " I " \
  | grep -c "^TCP:" 
echo "The DUPLICATE I packet counts by repeat number."
grep -A4 -e "vhf recv" /db/jnos/trace/$1 \
  | grep -A2 -B2 -e " I " \
  | grep  "^TCP:" \
  | uniq -cd \
  | sort -n \
  | uniq -cd -w8 
