Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!fu-berlin.de!uni-berlin.de!news.dfncis.de!not-for-mail From: =?UTF-8?Q?Hans-Bernhard_Br=c3=b6ker?= Newsgroups: comp.graphics.apps.gnuplot Subject: Re: Passing a GNUplot variable to system(/usr/bin/awk) Date: Sat, 20 Jun 2015 01:43:13 +0200 Lines: 15 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.dfncis.de lhWS0wvIKhibgg/Wzhh8OQuD5kQAwVgZOdAO8wCuhu8xs7l6Ka4kOUuk7C Cancel-Lock: sha1:107wY6etwh4M4itjCE40ESSGwvI= User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 In-Reply-To: Xref: csiph.com comp.graphics.apps.gnuplot:2945 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)