#! /bin/csh -f # cat -ALL- files in "good list" of the target dir into one huge file, # keeping only lat, lon, depth and srcId if ($#argv != 3) then echo "usage: $0 badFilesFile dir outfile" echo " example: $0 badfilelist cm huge.cm" exit endif set badlist = $1; shift set dir = $1; shift set ofile = $1; shift set opts = "$*" /bin/rm -rf $ofile touch $ofile # get all the good data from all the good files in the dir foreach file (`find $dir -name "*.cm"`) # check if this files sid is on bad list # only thing tricky is that we need leading zeros on sid to keep grep right if(`head -1 $file | awk '{ printf "%05d\n", $7 }' | grep -f - $badlist | wc -l` > 0) then # do nothing; i.e. skip this file echo "$file is bad" else jjCheckCmFile $file # cat the interesting parts of the file (xyzi) into huge one # punt pings with flag = 9999 echo "$file" cat $file | \ awk '{if ($6 != 9999) { printf "%s %s %s %05d\n", $2, $3, $4, $7 } }' \ >> $ofile endif end