
# This script takes files such as d3d1d12345w.* and concatenates
# them into a file such as d3d_12345_1d_w.dat with separators as
# required for the iter data base.
# usage: upack.sh d3d 1d 12345 w
# (or simply type upack.sh and wait for prompts)
# s.e.attenberger, ornl 12/94.
  dev=$1
  dim=$2
  shot=$3
  info=$4
  ansr="n"
  while [ "$ansr" != "y" ]; do
    dum="-"$dev"-"
    if [ "$dum" != "--" ];then
      printf "concatenate files "$dev$dim$shot$info".* ? <y,n>:"
      read ansr
    fi
    if [ "$ansr" != "y" ];then
      printf "device <"$dev">:"
      read dum
      if [ "$dum" != "" ];then
        dev=$dum
      fi
      printf "dimension <"$dim">:"
      read dum
      if [ "$dum" != "" ];then
        dim=$dum
      fi
      printf "shot <"$shot">:"
      read dum
      if [ "$dum" != "" ];then
        shot=$dum
      fi
       printf "info <"$info">:"
      read dum
      if [ "$dum" != "" ];then
        info=$dum
      fi 
    fi
  done
  cat > separator << EOF
************************************************************
************************************************************
EOF
  outfile=$dev"_"$shot"_"$dim"_"$info.dat
  test -f $outfile && rm $outfile
  for variable in `ls $dev$dim$shot$info.*`
  do
    cat $variable >> $outfile
    cat separator >> $outfile
  done
