Thread: naming files

Started: 2006-11-23 08:31:15
Last activity: 2006-11-24 02:47:04
Topics: SAC Help
Geo .
2006-11-23 08:31:15
I have a question regarding naming files. Assume that I have a sac file by
the name
say, If I want to extract only the 2006.300.33.SDMD part for naming purposes
after I do certain calculations on it, how do I do it?
would something like this work?

set bb name $1$.$STATION$ ?
w %name.z

It didn't so far for me?
Would like to hear any suggestions from any one out there....

Thank you.


On 11/14/06, sac-help-request<at> <
sac-help-request<at>> wrote:

Send sac-help mailing list submissions to

To subscribe or unsubscribe via the World Wide Web, visit
or, via email, send a message with subject or body 'help' to

You can reach the person managing the list at

When replying, please edit your Subject line so it is more specific
than "Re: Contents of sac-help digest..."

Today's Topics:

1. Re: Cut command (andreas wessel)


Message: 1
Date: Tue, 14 Nov 2006 13:44:57 +1300
From: "andreas wessel" <awbochum<at>>
Subject: Re: [SAC-HELP] Cut command
To: "Talal Merghelani" <talalmg1<at>>
Cc: SAC HELP <sac-help<at>>
Content-Type: text/plain; charset="iso-8859-1"

Hi Talal,

you could create a shellscript that runs your cutting macro for every
sac-file in the current directory:
I used that to byteswap a lot of files at once:

for j in $*
echo sac_starts_here %%%%%%%%%%%%%%%%
/usr/local/bin/sac /macro/macro.m $fn
exit 0

You have to adjust the pathes to point to your sac binary and to the macro
you want to use.
The macro looks like this:

r $1
"some other commands"

If you execute the shellscript with
" *.SAC"
the for loop will cycle through all the .SAC files, read every single one
sac and then execute the commands in the macro.
You still would have to figure out a way to calculate the parameters for
every file, but this depends on what you want.


On 11/14/06, Talal Merghelani <talalmg1<at>> wrote:

Hi all

i wanna use cut command for many files( 40~60 files) to cut
3-5sec time window), for each file they have their own values for cut
parameters(depend on S-wave).

i have reviewed the sac manual for cut command. but, there is no such
to select the command cut values indepently for each file..?

its time consuming doing this manaully...!!

there is any systematic way for doing this by writing a macros command

of course i care about the result quality. mean, should be the time that
wanna to cut it exaclty..!!

any idea any help..!! please, attached with an example..

thank you in advance

P.S. the input is in *.SAC file and the output is *.TXT file.


-------------- next part --------------
An HTML attachment was scrubbed...


sac-help mailing list

End of sac-help Digest, Vol 17, Issue 9

"Nothing can start to exist nor can cease to exist, only transformation is

Januka Attanayake
Center for Integrative Geosciences - Solid Earth Geophysics
University of Connecticut
Beach Hall U-2045
354,Mansfield Rd;
Storrs.CT 06269

Tel: 1 860 486 0475

  • andreas wessel
    2006-11-24 02:47:04
    Hi there,

    I think you have just a typing error.

    - setbb goes together, without a space..
    - to take a variable and append something, you have to put the delimiter at
    the end of the name of the var, just as you did with the $

    setbb name 1234
    sc echo %name%567

    You didn't post what error msg you get, but I think it is "Could not find
    VARS variable blackboard", because Sac is looking for a variable "name.z"
    instead of "name"

    good luck

    On 11/23/06, Januka Attanayake <jattanayake<at>> wrote:


    I want to extract only the 2006.300.33.SDMD part for naming purposes after I
    do certain calculations on it

    set bb name $1$.$STATION$ ?
    w %name.z

01:14:51 v.01697673