#!/bin/sh
#
# $Header: trcfmt 2001300.18 95/11/08 11:41:09 smaring Osd<unix> $ trcfmt.sh 
# Copyright (c) Oracle Corporation 1996.  All rights reserved.
#
# generates a .txt file out of the binary oracle trace .cdf and .dat files
# given the .cdf file name.
# For otrcfmt, the -h suppresses the per message header, the -p puts all
# of the messages in one process .txt rather than in several bundles and
# the -s suppresses the timestamp and event types. if you want to see the time
# stamp, then just execute otrcfmt -h -p name.cdf on your own.
 
#if no cdf file name then prompt them to re-enter it with the name.
if [ $# -eq 0 ]; then
   echo "Usage: trcfmt cdf_filename"
   echo "       where the cdf_file can be found in your trace directory"
else
#if the name given isn't a .cdf filename, then prompt them again.
  CDF=`echo $1 | grep "\.cdf"`
  if [ -z "$CDF" ]; then
   echo "Usage: trcfmt cdf_filename"
   echo "       where the cdf_file can be found in your trace directory"
   echo "       You didn't give a filename with the extension of .cdf"
  else
   otrcrep -h -p -s $1
   echo "Your oracle trace file is formatted into a yyy_Pxxx.txt file."
   echo "Where yyy is the trace file name."
   echo " and  xxx is the process id of the process traced."
fi
fi