Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #976

How to know total number of blocks in a file?

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
From ampbox@gmail.com
Newsgroups comp.graphics.apps.gnuplot
Subject How to know total number of blocks in a file?
Date Thu, 15 Mar 2012 07:43:43 -0700 (PDT)
Organization http://groups.google.com
Lines 20
Message-ID <5661512.256.1331822623825.JavaMail.geo-discussion-forums@ynhs12> (permalink)
NNTP-Posting-Host 134.94.164.189
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
X-Trace posting.google.com 1331822624 30014 127.0.0.1 (15 Mar 2012 14:43:44 GMT)
X-Complaints-To groups-abuse@google.com
NNTP-Posting-Date Thu, 15 Mar 2012 14:43:44 +0000 (UTC)
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=134.94.164.189; posting-account=14K4ewoAAACUaC1A5Gvuji1aDVzFdbIT
User-Agent G2/1.0
Xref csiph.com comp.graphics.apps.gnuplot:976

Show key headers only | View raw


Hi all,

I have a data file with multiple data blocks (groups of data lines separated by blank lines). I want to plot only the last block. 

I can do it like 

      plot 'filename' every :::<blockNO>::<blockNO> 

where <blockNO> is the block number, and since it is the last block, this number equals the total number of blocks in my data file.

The problem is, I don't know how many blocks are there in my data file. (Because my simulation adds a new block every few hours and the longer simulation runs, the more number of frames (block) I get.)

Is there a built-in variable like GPVAL_DATA_X_MAX etc. to give me this information? 

Another possible solution: can I get the number of lines etc. by a bash command (I am in Linux) INSIDE my gnuplot script and give it to a variable? I mean something like:

NBLOCKS = `!wc -l filename`

Thanks in advance,
Masoud.

Back to comp.graphics.apps.gnuplot | Previous | NextNext in thread | Find similar


Thread

How to know total number of blocks in a file? ampbox@gmail.com - 2012-03-15 07:43 -0700
  Re: How to know total number of blocks in a file? sfeam <sfeam@users.sourceforge.net> - 2012-03-15 09:53 -0700
    Re: How to know total number of blocks in a file? sfeam <sfeam@users.sourceforge.net> - 2012-03-15 11:34 -0700

csiph-web