#!/bin/bash
# create a SAC macro to rotate the data,
# and save in /tmp
cat << END > /tmp/ExtractPick
r T.SAC
message '&1,gcarc& &1,t1&'
quit
END
# create an empty pick file
cat /dev/null > pickfile
# outer (station) loop
for station in UB/UB??
do
cd $station
# inner (event) loop
for event in EV??
do
cd $event
# run SAC, and put the last line of output
# into the pick file
sac /tmp/ExtractPick | tail -1 >> ../../../pickfile
cd ..
done
cd ../..
done
# End of script.