#!/bin/bash

###########################################################
#        name: countwaits.sh
#     version: 0.0
# description: counts the wait events in an Oracle 10046 
#              trace file
#    synopsis: one argument -- the file name
#  created by: David Clement
#        date: ??-FEB-2004 
# modified by:
#        date:
###########################################################

for i in $(grep WAIT $1 | cut -d "'" -f 2 | tr -d 'SQL*' | sort -u | tr ' ' '_')
do
	(echo -e "$i\t\c" | tr '_' ' ') && grep -c "$(echo $i | tr '_' ' ')" $1
done