#!/bin/csh -f
#
# newextract - get metrics from sim files (*.sim)
#
set usage='usage: newextract metricfilename configdir ...'
#
# Part of
#              The STARFISH Parallel file-system simulator
#        (Simulation Tool for Advanced Research in File Systems)
# 
#                               David Kotz
#                           Dartmouth College
#                              Version 3.0
#                              January 1996
#                          dfk@cs.dartmouth.edu

if ($#argv < 2) then
	echo "$usage"
	exit 1
endif

if (! -f $1) then 
	echo "$usage"
	exit 1
endif

set metrics=`cat $1`
shift

source environset

foreach dir ($*)
    echo $dir
    # make a list of base names
    set files=(`ls $dir/results/*sim* | sed 's/\.[0-9]*\.sim.*//' | uniq`)

    foreach file ($files)
	newextract-one $file $metrics
    end	
end
