用于 Gnuplot 输入的多个管道
使用 Gnuplot 读取数据时是否有使用多个管道的方法? 下面将绘制直接从 SQL 语句接收的数据。
plot "< sqlite3 tomato-rstats.db \"SELECT data FROM table;\""
我想要的是在数据到达 Gnuplot 之前对其进行处理。 我知道我可以通过脚本传输 SQL 数据,输出到中间文件,并绘制该文件,但我宁愿跳过临时文件。我想象了类似以下的内容,但这显然不是正确的语法。
plot "< sqlite3 tomato-rstats.db \"从表中选择数据;\" | process.pl"
或
plot "< process.pl < sqlite3 tomato-rstats.db \"SELECT data FROM table;\""
这可以通过其他语法实现吗?
Is there a method to use multiple pipes when reading data with Gnuplot?
The following will plot data received directly from the SQL statement.
plot "< sqlite3 tomato-rstats.db \"SELECT data FROM table;\""
What I'd like is to process that data before it reaches Gnuplot.
I know that I could pipe the SQL data through the script, output to an intermediary file, and plot that file, but I'd rather skip the temp file. I imagined something along the lines of the following, but it's clearly not the correct syntax.
plot "< sqlite3 tomato-rstats.db \"SELECT data FROM table;\" | process.pl"
or
plot "< process.pl < sqlite3 tomato-rstats.db \"SELECT data FROM table;\""
Is this possible through some other syntax?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
按照您的建议使用
在 gnuplot 中工作得很好。您可以使用管道命令的任意组合作为 gnuplot 的输入,例如,
绘制
file.txt
第五行中的前 100 个项目。应该注意的是,使用它作为绘图的输入是没有用的,因为这个处理可以在 gnuplot 本身内部完成,但它显示了使用 UNIX 命令行及其管道来预处理输入的可能性。不用说,这在非 UNIX 系统(如 Windows)上不起作用。
Using
as you suggested works just fine in gnuplot. You can use any combination of piped commands as an input for gnuplot, e.g.,
plots the first 100 items in the fifth row of
file.txt
. It should be noted that using this as an input for plotting is useless as this processing can be done from within gnuplot itself, but it shows the possibilities of using your UNIX command line and its pipes for preprocessing input.Needless to say, this does not work on non-UNIX systems, like Windows.