• command from inside gnuplot

    From =?UTF-8?Q?J=C3=B6rg_Buchholz?=@21:1/5 to All on Tue Nov 7 10:24:38 2023
    Hi,

    i have a problem to use a system command from inside gnuplot.

    sed -i 's/^\xef\xbb\xbf//' ./process-2023-11-02-13-04-40.csv

    works at the terminal


    system "sed -i 's/^\xef\xbb\xbf//' ./process-2023-11-02-13-04-40.csv"
    and
    system(sprintf("sed -i 's/^\xef\xbb\xbf//'
    ./process-2023-11-02-13-04-40.csv"))

    in a gnuplot script do not work, but gnuplot shows me

    GPVAL_SYSTEM_ERRNO = 0
    GPVAL_SYSTEM_ERRMSG = "Success"


    as a test I try

    system "cp ./process-2023-11-02-13-04-40.csv ./process-2023-11-02-13-04-40.test"

    this works, the file process-2023-11-02-13-04-40.test was created.


    what's wrong?

    Jörg

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Chris Elvidge@21:1/5 to All on Tue Nov 7 10:16:27 2023
    On 07/11/2023 09:24, Jörg Buchholz wrote:
    Hi,

    i have a problem to use a system command from inside gnuplot.

    sed -i 's/^\xef\xbb\xbf//' ./process-2023-11-02-13-04-40.csv

    works at the terminal


    system "sed -i 's/^\xef\xbb\xbf//' ./process-2023-11-02-13-04-40.csv"
    and
    system(sprintf("sed -i 's/^\xef\xbb\xbf//' ./process-2023-11-02-13-04-40.csv"))

    Shouldn't that be just:
    system("sed -i 's/^\xef\xbb\xbf//' ./process-2023-11-02-13-04-40.csv")
    After all, sprintf isn't a system command and you're not expecting any
    output.


    in a gnuplot script do not work, but gnuplot shows me

    GPVAL_SYSTEM_ERRNO = 0
    GPVAL_SYSTEM_ERRMSG = "Success"


    as a test I try

    system "cp ./process-2023-11-02-13-04-40.csv ./process-2023-11-02-13-04-40.test"

    this works, the file process-2023-11-02-13-04-40.test was created.


    what's wrong?

    Jörg



    --
    Chris Elvidge, England
    RUDOLPH'S RED NOSE IS NOT ALCOHOL-RELATED

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Hans-Bernhard_Br=C3=B6ker@21:1/5 to All on Tue Nov 7 18:52:17 2023
    Am 07.11.2023 um 10:24 schrieb Jörg Buchholz:
    Hi,

    i have a problem to use a system command from inside gnuplot.

    sed -i 's/^\xef\xbb\xbf//' ./process-2023-11-02-13-04-40.csv

    works at the terminal


    system "sed -i 's/^\xef\xbb\xbf//' ./process-2023-11-02-13-04-40.csv"
    and
    system(sprintf("sed -i 's/^\xef\xbb\xbf//' ./process-2023-11-02-13-04-40.csv"))

    Unfortunately this suffers from a lack of escaping. Please note that
    "strings in double quotes" go through some pre-processing in gnuplot,
    including backslash escape substitution done to them before being used.
    So if you want literal backslashes, they have to be escaped. See "help
    quote" for the details.

    What that means is that

    system "sed -i 's/^\\xef\\xbb\\xbf//' ./process-2023-11-02-13-04-40.csv"

    should work better.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?J=C3=B6rg_Buchholz?=@21:1/5 to All on Wed Nov 8 07:27:16 2023
    On 07.11.23 18:52, Hans-Bernhard Bröker wrote:
    Am 07.11.2023 um 10:24 schrieb Jörg Buchholz:
    Hi,

    i have a problem to use a system command from inside gnuplot.

    sed -i 's/^\xef\xbb\xbf//' ./process-2023-11-02-13-04-40.csv

    works at the terminal


    system "sed -i 's/^\xef\xbb\xbf//' ./process-2023-11-02-13-04-40.csv"
    and
    system(sprintf("sed -i 's/^\xef\xbb\xbf//'
    ./process-2023-11-02-13-04-40.csv"))

    Unfortunately this suffers from a lack of escaping.  Please note that "strings in double quotes" go through some pre-processing in gnuplot, including backslash escape substitution done to them before being used.
    So if you want literal backslashes, they have to be escaped. See "help
    quote" for the details.

    What that means is that

    system "sed -i 's/^\\xef\\xbb\\xbf//' ./process-2023-11-02-13-04-40.csv"

    should work better.

    That's it. Thanks a lot. I was nearby, but use the wrong slash to
    escaped backslashes.

    Jörg

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)