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
Greetings,
I have a question regarding naming files. Assume that I have a sac file by
the name
2006.300.33.SDMD.BHZ.R.SAC
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.

Januka

On 11/14/06, sac-help-request<at>iris.washington.edu <
sac-help-request<at>iris.washington.edu> wrote:

Send sac-help mailing list submissions to
sac-help<at>iris.washington.edu

To subscribe or unsubscribe via the World Wide Web, visit
http://www.iris.washington.edu/mailman/listinfo/sac-help
or, via email, send a message with subject or body 'help' to
sac-help-request<at>iris.washington.edu

You can reach the person managing the list at
sac-help-owner<at>iris.washington.edu

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>gmail.com>
Subject: Re: [SAC-HELP] Cut command
To: "Talal Merghelani" <talalmg1<at>yahoo.com>
Cc: SAC HELP <sac-help<at>iris.washington.edu>
Message-ID:
<2afddd310611131644k148e9719x21a328c850048ca8<at>mail.gmail.com>
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 $*
do
fn=$j
echo sac_starts_here %%%%%%%%%%%%%%%%
/usr/local/bin/sac /macro/macro.m $fn
done
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"
q


If you execute the shellscript with
"script.sh *.SAC"
the for loop will cycle through all the .SAC files, read every single one
in
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.

ciao,
Andreas




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

Hi all

i wanna use cut command for many files( 40~60 files) to cut
S-wave(usually
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
way
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
file..?

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

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

thank you in advance
Talal

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

------------------------------

-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://www.iris.washington.edu/pipermail/sac-help/attachments/20061113/b953fb91/attachment-0001.html

------------------------------

_______________________________________________
sac-help mailing list
sac-help<at>iris.washington.edu
http://www.iris.washington.edu/mailman/listinfo/sac-help


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




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

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
http://www.geocities.com/jattanayake
http://earth.uconn.edu/

  • 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
    andreas

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

    2006.300.33.SDMD.BHZ.R.SAC

    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



02:19:51 v.22510d55