[SAC-HELP] select waveform with sac

George Helffrich george.helffrich at bristol.ac.uk
Wed Nov 9 21:30:57 PST 2011


Dear Xuzhang -

	SAC is reading input from the shell script, not your terminal.  It is probably giving an end-of-file to the REPLY function.
	Use a review procedure structured like this:

# Define sac macro called /tmp/view.m
cat << 'EOF' > /tmp/view.m
message "Processing $1$"
read $1$
setbb resp "(reply Enter t to trash the file)"
if _%resp% eq _t
sc mv $1$ Trash
endif
'EOF'
# Create sac input file
ls *.SAC | awk '{print "m /tmp/view.m",$1}' > /tmp/sac.in
# Run SAC once, process all files
sac
qdp off
ygrid on
message "Many questions about files will happen now ..."
m /tmp/sac.in
quit

On 10 Nov 2011, at 04:15, shenxzh at gmail.com wrote:

> Hello everyone,
> I met a question to select waveform with sac. I hope I can check the waveform and save some good data in a folder or put bad data in another folder. The following is the part of my shell script.
> for fil in *.SAC
> do
> sac <<ENDD
> qdp off
> ygrid on
> r AA.SAC
> p1
> setbb resp (REPLY "Enter t to trash the file ")
> if %resp eq "t" then
> sc mv AA.SAC Trash
> endif
> q
> ENDD
> done
> After excuting the shell script, there was no any pause and just put the *.SAC into the Trash folder. What' s problem in my script and how to solve it.
> Thank you.
> Cheers, Xuzhang
>  
> 2011-11-10
> _______________________________________________
> sac-help mailing list
> sac-help at iris.washington.edu
> http://www.iris.washington.edu/mailman/listinfo/sac-help



          George Helffrich
          george.helffrich at bris.ac.uk





More information about the sac-help mailing list