#!/bin/csh
# crappy brute force scripting works for up to 20 workloads
# expects log files of the form nodename-yyy-mm-dd from workollator_example.sh
echo exploding $1:t
set DATE=`nawk -v dir=$1:t 'BEGIN {print substr(dir,length(dir)-9, 10)}' </dev/null`
set HOST=`nawk -v dir=$1:t 'BEGIN {print substr(dir,0,length(dir)-11)}' </dev/null`
set WORKS=`tail -1 $1 | cut -c1-2`
echo date is $DATE host is $HOST workloads is $WORKS
mkdir -p workollator/${HOST}_0
/opt/RICHPse/workollator/pwgrab " 0" $1 > workollator/${HOST}_0/workol-$DATE
if ( $WORKS == "0" ) exit
mkdir -p workollator/${HOST}_1
/opt/RICHPse/workollator/pwgrab " 1" $1 > workollator/${HOST}_1/workol-$DATE
if ( $WORKS == "1" ) exit
mkdir -p workollator/${HOST}_2
/opt/RICHPse/workollator/pwgrab " 2" $1 > workollator/${HOST}_2/workol-$DATE
if ( $WORKS == "2" ) exit
mkdir -p workollator/${HOST}_3
/opt/RICHPse/workollator/pwgrab " 3" $1 > workollator/${HOST}_3/workol-$DATE
if ( $WORKS == "3" ) exit
mkdir -p workollator/${HOST}_4
/opt/RICHPse/workollator/pwgrab " 4" $1 > workollator/${HOST}_4/workol-$DATE
if ( $WORKS == "4" ) exit
mkdir -p workollator/${HOST}_5
/opt/RICHPse/workollator/pwgrab " 5" $1 > workollator/${HOST}_5/workol-$DATE
if ( $WORKS == "5" ) exit
mkdir -p workollator/${HOST}_6
/opt/RICHPse/workollator/pwgrab " 6" $1 > workollator/${HOST}_6/workol-$DATE
if ( $WORKS == "6" ) exit
mkdir -p workollator/${HOST}_7
/opt/RICHPse/workollator/pwgrab " 7" $1 > workollator/${HOST}_7/workol-$DATE
if ( $WORKS == "7" ) exit
mkdir -p workollator/${HOST}_8
/opt/RICHPse/workollator/pwgrab " 8" $1 > workollator/${HOST}_8/workol-$DATE
if ( $WORKS == "8" ) exit
mkdir -p workollator/${HOST}_9
/opt/RICHPse/workollator/pwgrab " 9" $1 > workollator/${HOST}_9/workol-$DATE
if ( $WORKS == "9" ) exit
mkdir -p workollator/${HOST}_10
/opt/RICHPse/workollator/pwgrab "10" $1 > workollator/${HOST}_10/workol-$DATE
if ( $WORKS == "10" ) exit
mkdir -p workollator/${HOST}_11
/opt/RICHPse/workollator/pwgrab "11" $1 > workollator/${HOST}_11/workol-$DATE
if ( $WORKS == "11" ) exit
mkdir -p workollator/${HOST}_12
/opt/RICHPse/workollator/pwgrab "12" $1 > workollator/${HOST}_12/workol-$DATE
if ( $WORKS == "12" ) exit
mkdir -p workollator/${HOST}_13
/opt/RICHPse/workollator/pwgrab "13" $1 > workollator/${HOST}_13/workol-$DATE
if ( $WORKS == "13" ) exit
mkdir -p workollator/${HOST}_14
/opt/RICHPse/workollator/pwgrab "14" $1 > workollator/${HOST}_14/workol-$DATE
if ( $WORKS == "14" ) exit
mkdir -p workollator/${HOST}_15
/opt/RICHPse/workollator/pwgrab "15" $1 > workollator/${HOST}_15/workol-$DATE
if ( $WORKS == "15" ) exit
mkdir -p workollator/${HOST}_16
/opt/RICHPse/workollator/pwgrab "16" $1 > workollator/${HOST}_16/workol-$DATE
if ( $WORKS == "16" ) exit
mkdir -p workollator/${HOST}_17
/opt/RICHPse/workollator/pwgrab "17" $1 > workollator/${HOST}_17/workol-$DATE
if ( $WORKS == "17" ) exit
mkdir -p workollator/${HOST}_18
/opt/RICHPse/workollator/pwgrab "18" $1 > workollator/${HOST}_18/workol-$DATE
if ( $WORKS == "18" ) exit
mkdir -p workollator/${HOST}_19
/opt/RICHPse/workollator/pwgrab "19" $1 > workollator/${HOST}_19/workol-$DATE
