Thread: Cut command

Started: 2006-11-13 15:05:33
Last activity: 2006-11-14 21:44:57
Topics: SAC Help
Talal
2006-11-13 15:05:33
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.


---------------------------------
Everyone is raving about the all-new Yahoo! Mail beta.
  • andreas wessel
    2006-11-14 21:44:57
    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.

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


01:07:18 v.01697673