Thread: Using the system command with "to" (Version 101.5c)

Started: 2015-09-15 16:18:39
Last activity: 2015-09-16 16:04:58
Topics: SAC Help
Shahar Barak
2015-09-15 16:18:39
Hi,

I would like to read multiple SAC files into memory using a file which
contains the SAC file names.
According to the SAC book, I can do:
systemcommand to list cat list_file
while read list filename
read filename
enddo
However, I get the error:
"sh: to: command not found"

Why isn't this working?
According to the online command index there's no "to" syntax for
systemcommand:
http://ds.iris.edu/files/sac-manual/commands/systemcommand.html

Is there a different way to do this?

Thanks,

Shahar

  • Milton Plasencia
    2015-09-16 03:45:46
    Hi Shakar,

    system command wait for a command of operating system and options.

    but you can use a macro,

    the manual suggest:
    In the next example we modify the previous one to now process all of the files in the directory called "MYDIR" that end in the letters ".Z":

    DO FILE WILD DIR MYDIR *.Z
    MACRO PREVIEW $FILE
    ENDDO
    Perhaps it help you,

    Cheers,

    Milton

    On Sep 15, 2015, at 18:20, Shahar Barak <shaharb<at>stanford.edu> wrote:

    Hi,

    I would like to read multiple SAC files into memory using a file which contains the SAC file names.
    According to the SAC book, I can do:
    systemcommand to list cat list_file
    while read list filename
    read filename
    enddo
    However, I get the error:
    "sh: to: command not found"

    Why isn't this working?
    According to the online command index there's no "to" syntax for systemcommand:
    http://ds.iris.edu/files/sac-manual/commands/systemcommand.html

    Is there a different way to do this?

    Thanks,

    Shahar

    ----------------------
    SAC Help (http://ds.iris.edu/message-center/topic/sac-help/)

    Sent via IRIS Message Center (http://ds.iris.edu/message-center/)
    Update subscription preferences at http://ds.iris.edu/account/profile/


    Attachments
  • George Helffrich
    2015-09-16 16:04:58
    Dear Shahar -

    Unfortunately, this is one of the differences in the features that IRIS SAC provides and the SAC implementation documented in the book. If you want to take advantage of those features that make interacting with the host system easier, you can download and install that version.

    The TO option on SYSTEMCOMMAND takes the output from the host system command and puts it into a blackboard variable that can be manipulated line-by-line with the WHILE READ command, much like the Unix shell’s read command.

    On 16 Sep 2015, at 01:20, Shahar Barak <shaharb<at>stanford.edu> wrote:

    Hi,

    I would like to read multiple SAC files into memory using a file which contains the SAC file names.
    According to the SAC book, I can do:
    systemcommand to list cat list_file
    while read list filename
    read filename
    enddo
    However, I get the error:
    "sh: to: command not found"

    Why isn't this working?
    According to the online command index there's no "to" syntax for systemcommand:
    http://ds.iris.edu/files/sac-manual/commands/systemcommand.html

    Is there a different way to do this?

    Thanks,

    Shahar

    ----------------------
    SAC Help (http://ds.iris.edu/message-center/topic/sac-help/)

    Sent via IRIS Message Center (http://ds.iris.edu/message-center/)
    Update subscription preferences at http://ds.iris.edu/account/profile/



    George Helffrich
    george.helffrich<at>bris.ac.uk


04:12:20 v.22510d55