#!/bin/bash
#<pre><b>
# Script     : badprot
# Version    : 1.0
# Author     : Roland Rashleigh-Berry
# Date       : 04-Mar-2007
# Purpose    : To list which SAS programs do not have a correct protocol
#              in the standard header.
# SubScripts : none
# Notes      : none
# Usage      : badprot
#              
#===============================================================================
# PARAMETERS:
#-pos- -------------------------------description-------------------------------
# N/A  Do not supply any parameters
#===============================================================================
# AMENDMENT HISTORY:
# init --date-- mod-id ----------------------description------------------------
# rrb  04Mar07         "getfields" script used
#===============================================================================
# This is public domain software. No guarantee as to suitability or accuracy is
# given or implied. User uses this code entirely at their own risk.
#===============================================================================

# No parameters required
if [ $# -gt 0 ] ; then
  echo "Usage: badprot # do not supply any parameters" 1>&2
  exit 1
fi

study=$(getfields | cut -d/ -f4)

grep "^/ Protocol *: .* *" *.sas | gawk -F: 'index($3,prot)==0' prot="$study"
