Thread: help-"merge"

Started: 2009-03-10 02:35:21
Last activity: 2009-03-10 02:35:21
Topics: SAC Help
Zhouchuan Huang
2009-03-10 02:35:21
Hello,

I have problem using "merge".
I would like to read file names from another file and make it as variables.
But it seems that the "merge" command needs a full name.
e.g. I can read a file this way:* r 1997.123.*.sac*, it works well.
but when I use merge: *merge 1997.123*.sac*, it returns the error: *Error
108: file does not exist*.

So could you help me? Thank you very much!

--
Zhouchuan Huang
School of Earth Sciences and Engineering
Nanjing University
22 Hankou Road
Nanjing 210093
P.R.CHINA.
Tel:+86 13675137130

  • George Helffrich
    2009-03-09 19:55:41
    Dear Zhouchuan Huang -

    This is probably not what you want to do. If you look at the merge
    command documentation, merge works as a binary operator: it merges one
    file in memory with a file in a list. Thus, if you have

    file.z
    file_a.z
    file_b.z
    file_c.z

    in your directory and then

    READ file.z; MERGE file_*.z

    this would be an error: only one file is in memory, and three files are
    in your list. Rather, you'd want

    READ file; MERGE file_a.z; MERGE file_b.z; MERGE file_c.z

    But if you really have three files in memory, then

    MERGE file_*.z

    should work. If not, it is a bug, but you can work around it by doing
    something like,

    cat << EOF > domerge
    sc echo $1$ | awk '{printf "setbb flist \"@%s\"\n",@$0}' >
    /tmp/tmp.macro
    m /tmp/tmp.macro
    sc rm /tmp/tmp.macro
    merge %flist%
    unsetbb flist
    EOF

    macro domerge 1997.123*.sac

    On 9 Mar 2009, at 11:35, Zhouchuan Huang wrote:

    Hello,

    I have problem using "merge".
    I would like to read file names from another file and make it as
    variables. But it seems that the "merge" command needs a full name.
    e.g. I can read a file this way: r 1997.123.*.sac, it works well.
    but when I use merge: merge 1997.123*.sac, it returns the error:
    Error 108: file does not exist.

    So could you help me? Thank you very much!

    --
    Zhouchuan Huang
    School of Earth Sciences and Engineering
    Nanjing University
    22 Hankou Road
    Nanjing 210093
    P.R.CHINA.
    Tel:+86 13675137130




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

    George Helffrich
    george<at>geology.bristol.ac.uk

Page built 04:28:43 | v.b'59d0d2