如何从终端绘制标准输入?

m f*_*ran 6 linux bash

我有一堆二进制文件输出如下数据:

-0.002019
-0.000790
0.000158
0.001539
Run Code Online (Sandbox Code Playgroud)

这只是一堆数字,我想在 y 轴上绘制在 x 轴上具有相等间距的数字。

输出实际上有几千行长。

我需要一种简单的方法将它传递给绘制它的东西,如下所示:

./program_dumping_numbers | ??? # a simple window of the plot pops up!
Run Code Online (Sandbox Code Playgroud)

kma*_*arz 7

请尝试以下操作:

./program_dumping_numbers | gnuplot -p -e 'plot "/dev/stdin" using 0:1 with lines'
Run Code Online (Sandbox Code Playgroud)

其中 0 是虚拟行号,1 是列号,“带行”表示连续行而不仅仅是点


小智 5

我强烈推荐ttyplot,您可以直接在终端中构建实时图形,从 STDIN 读取数据

在此处输入图片说明