Thread: run sac macro in a shell script

Started: 2013-11-22 23:29:07
Last activity: 2013-11-22 23:29:07
Topics: SAC Help
Metin Kahraman
2013-11-22 23:29:07
Dear sac users,

I having a problem which you may come across before with the error. my
problem is, I would like to run simple sac macro in a shell scrip. the
reason of this if I have too much file in the folder sac macro gives a
segmentation fault which I can not relate with anything. so I am trying
to give sac file 3 component by 3 component in the sac macro.

But the thing is I do this, setbb command in the macro does not work. I
attached my shell and macro files,

any help will be grateful,
Metin Kahraman
_shell _
#!/bin/bash

mkdir done_events
mkdir tmp
#mkdir Trash

for filename in *1.sac
do
ls $filename > out11
vert=`cut -c 1-19 out11`1.sac
north=`cut -c 1-19 out11`2.sac
east=`cut -c 1-19 out11`3.sac
#######################################################
if [ -f $vert ] && [ -f $north ] && [ -f $east ]; then
echo ====exissttt======
sac << EOF
macro pick_v1.mac file $filename
EOF
else
echo ===$filename==component missing=====
echo ======does not exisst=====
#mv $vert $north $east MISSING-COMPONENTS
fi
rm out11
done


*_sacmacro_*
*
$keys file
$default file " "
echo on
qdp off
ygrid on

setbb vert $file
setbb data (substring 1 19 '$file$')
setbb east '( CHANGE '1.sac' '3.sac' %vert )'
setbb north '( CHANGE '1.sac' '2.sac' %vert )'

r %vert %east %north
ppk bell off
setbb ans (REPLY " 1- CONTINUE, 2- NEXT or 3- DELETE the waveform ")
if %ans eq 1 then
ppk
endif


21:26:36 v.b3198453