#!/bin/csh -f
#
# average: average all of the data files in the given directories
#

foreach dir ($*)
    if (-d $dir) then
       pushd $dir
       foreach file (*.data)
           avg a s < $file > $file-a
       end
       popd
    endif
end
