Path: csiph.com!news.mixmin.net!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: =?UTF-8?Q?J=C3=B6rg_Buchholz?= Newsgroups: comp.graphics.apps.gnuplot Subject: Re: command from inside gnuplot Date: Wed, 8 Nov 2023 07:27:16 +0100 Organization: A noiseless patient Spider Lines: 32 Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Wed, 8 Nov 2023 06:27:17 -0000 (UTC) Injection-Info: dont-email.me; posting-host="e5daefa1c200da6fba3ca277d51e9afa"; logging-data="1565496"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+g7GlRIANFmZ5Qq76AVcNAvIAoO7ayk3Q=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:lK/daT9SbynTLgzCnTee+fYYgV0= In-Reply-To: Content-Language: de-DE Xref: csiph.com comp.graphics.apps.gnuplot:4552 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