Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

I dunno, I dream in Perl sometimes... -- Larry Wall in <8538@jpl-devvax.JPL.NASA.GOV>


devel / comp.graphics.apps.gnuplot / Re: sprintf: max number of characters printed?

SubjectAuthor
* sprintf: max number of characters printed?Konstantinos Anagnostopoulos
`- Re: sprintf: max number of characters printed?Konstantinos Anagnostopoulos

1
sprintf: max number of characters printed?

<8752a15b-a23d-416b-9bf1-9e4e5cb341e5n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=60&group=comp.graphics.apps.gnuplot#60

  copy link   Newsgroups: comp.graphics.apps.gnuplot
X-Received: by 2002:a05:620a:462b:: with SMTP id br43mr15044479qkb.301.1635872443982;
Tue, 02 Nov 2021 10:00:43 -0700 (PDT)
X-Received: by 2002:a25:dc50:: with SMTP id y77mr35373284ybe.119.1635872441552;
Tue, 02 Nov 2021 10:00:41 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.graphics.apps.gnuplot
Date: Tue, 2 Nov 2021 10:00:41 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=2a02:587:3208:a318:fd1b:a19b:ad6a:aab7;
posting-account=acGMqwkAAAChOnMc1fXABlAWOVDb_i3e
NNTP-Posting-Host: 2a02:587:3208:a318:fd1b:a19b:ad6a:aab7
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <8752a15b-a23d-416b-9bf1-9e4e5cb341e5n@googlegroups.com>
Subject: sprintf: max number of characters printed?
From: k.n.anag...@gmail.com (Konstantinos Anagnostopoulos)
Injection-Date: Tue, 02 Nov 2021 17:00:43 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 18
 by: Konstantinos Anagnos - Tue, 2 Nov 2021 17:00 UTC

Hi I am trying to write a string to be used as a command in a script.

When the filenames are too long the string get truncated. See e.g.:

files="aaaD_01.ava0 aaaD_02.ava0 aaaD06N0012n0004s+01.0000k001.0000B001.0000K000.9368i-02.2617e+00.0000m+01.0000g02.ava0 1234567890123456789012345678901234567890123456789001234567890012345678900123456789001234567890"

do for [f in files]{ print sprintf("head %s|awk '/srkappa/{printf \"(\%7.4f,\%7.4f)\",$4,$5}'",f)}

Produces the output:

head aaaD_01.ava0|awk '/srkappa/{printf "(%7.4f,%7.4f)",$4,$5}'
head aaaD_02.ava0|awk '/srkappa/{printf "(%7.4f,%7.4f)",$4,$5}'
head aaaD06N0012n0004s+01.0000k001.0000B001.0000K000.9368i-02.2617e+00.0000m+01.0000g02.ava0|awk '/srkappa/{printf "(%7.4f,%7.4f)",$
head 1234567890123456789012345678901234567890123456789001234567890012345678900123456789001234567890|awk '/srkappa/{printf "(%7.4f,%7

i.e. the last two commands are incomplete. Is there a way to control this output? Thank you.

I am suing gnuplot 5.2 patchlevel 8 last modified 2019-12-01 on ubuntu 20.04.

Re: sprintf: max number of characters printed?

<86f9bfdd-8c63-4849-89a1-84b1fc7b3dc4n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=61&group=comp.graphics.apps.gnuplot#61

  copy link   Newsgroups: comp.graphics.apps.gnuplot
X-Received: by 2002:a05:620a:1a84:: with SMTP id bl4mr21108236qkb.411.1635874850841;
Tue, 02 Nov 2021 10:40:50 -0700 (PDT)
X-Received: by 2002:a5b:802:: with SMTP id x2mr41310431ybp.164.1635874850432;
Tue, 02 Nov 2021 10:40:50 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.graphics.apps.gnuplot
Date: Tue, 2 Nov 2021 10:40:50 -0700 (PDT)
In-Reply-To: <8752a15b-a23d-416b-9bf1-9e4e5cb341e5n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2a02:587:3208:a318:fd1b:a19b:ad6a:aab7;
posting-account=acGMqwkAAAChOnMc1fXABlAWOVDb_i3e
NNTP-Posting-Host: 2a02:587:3208:a318:fd1b:a19b:ad6a:aab7
References: <8752a15b-a23d-416b-9bf1-9e4e5cb341e5n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <86f9bfdd-8c63-4849-89a1-84b1fc7b3dc4n@googlegroups.com>
Subject: Re: sprintf: max number of characters printed?
From: k.n.anag...@gmail.com (Konstantinos Anagnostopoulos)
Injection-Date: Tue, 02 Nov 2021 17:40:50 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 54
 by: Konstantinos Anagnos - Tue, 2 Nov 2021 17:40 UTC

OK, replacing %s -> %120s (or %-120s) does not chop the command and prints it correctly, but it is still a mystery why %s prints the output as mentioned before since it does not chop the string corresponding to %s but the last characters of the resulting string.

files="aaaD_01.ava0 aaaD_02.ava0 aaaD06N0012n0004s+01.0000k001.0000B001.0000K000.9368i-02.2617e+00.0000m+01.0000g02.ava0 1234567890123456789012345678901234567890123456789001234567890012345678900123456789001234567890END"

do for [f in files]{ print sprintf("head %120s|awk '/srkappa/{printf \"(\%7..4f,\%7.4f)\",$4,$5}'",f)}
head aaaD_01.ava0|awk '/srkappa/{printf "(%7.4f,%7.4f)",$4,$5}'
head aaaD_02.ava0|awk '/srkappa/{printf "(%7.4f,%7.4f)",$4,$5}'
head aaaD06N0012n0004s+01.0000k001.0000B001.0000K000.9368i-02.2617e+00.0000m+01.0000g02.ava0|awk '/srkappa/{printf "(%7.4f,%7.4f)",$4,$5}'
head 1234567890123456789012345678901234567890123456789001234567890012345678900123456789001234567890END|awk '/srkappa/{printf "(%7.4f,%7.4f)",$4,$5}'

On Tuesday, November 2, 2021 at 7:00:44 PM UTC+2, Konstantinos Anagnostopoulos wrote:
> Hi I am trying to write a string to be used as a command in a script.
>
> When the filenames are too long the string get truncated. See e.g.:
>
> files="aaaD_01.ava0 aaaD_02.ava0 aaaD06N0012n0004s+01.0000k001.0000B001..0000K000.9368i-02.2617e+00.0000m+01.0000g02.ava0 1234567890123456789012345678901234567890123456789001234567890012345678900123456789001234567890"
>
> do for [f in files]{ print sprintf("head %s|awk '/srkappa/{printf \"(\%7.4f,\%7.4f)\",$4,$5}'",f)}
>
> Produces the output:
>
> head aaaD_01.ava0|awk '/srkappa/{printf "(%7.4f,%7.4f)",$4,$5}'
> head aaaD_02.ava0|awk '/srkappa/{printf "(%7.4f,%7.4f)",$4,$5}'
> head aaaD06N0012n0004s+01.0000k001.0000B001.0000K000.9368i-02.2617e+00.0000m+01.0000g02.ava0|awk '/srkappa/{printf "(%7.4f,%7.4f)",$
> head 1234567890123456789012345678901234567890123456789001234567890012345678900123456789001234567890|awk '/srkappa/{printf "(%7.4f,%7
>
>
> i.e. the last two commands are incomplete. Is there a way to control this output? Thank you.
>
> I am suing gnuplot 5.2 patchlevel 8 last modified 2019-12-01 on ubuntu 20..04.

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor