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


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

Re: Passing a GNUplot variable to system(/usr/bin/awk)

From Hans-Bernhard Bröker <HBBroeker@t-online.de>
Newsgroups comp.graphics.apps.gnuplot
Subject Re: Passing a GNUplot variable to system(/usr/bin/awk)
Date 2015-06-20 01:43 +0200
Message-ID <cujnoeFgserU1@mid.dfncis.de> (permalink)
References <f1dbf443-8220-4a41-bb98-a03c6c71acea@googlegroups.com>

Show all headers | View raw


Am 18.06.2015 um 03:00 schrieb Dan'l B:
> This line in GNUplot works fine:
>
> system("/usr/bin/awk '/-1.98/{print $2 $1}' /path/to/myfile.txt")
>
> But how would I pass a variable from GNUplot into that in place of the -1.98 value?

About the most straightforward way would probably be to use gnuplot's 
string manipulation functions to construct your awk command line, e.g.

	awkcommand = sprintf("/usr/bin/awk '/%f/{print $2 $1}' 
/path/to/myfile.txt", STATS_max_y)
	system(awkcommand)

Back to comp.graphics.apps.gnuplot | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Passing a GNUplot variable to system(/usr/bin/awk) "Dan'l B" <dan.hinckley@gmail.com> - 2015-06-17 18:00 -0700
  Re: Passing a GNUplot variable to system(/usr/bin/awk) Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2015-06-20 01:43 +0200
    Re: Passing a GNUplot variable to system(/usr/bin/awk) "Dan'l B" <dan.hinckley@gmail.com> - 2015-06-20 07:58 -0700

csiph-web