将文本文件通过管道传输到gnuplot [英] Pipe a text file to gnuplot

查看:57
本文介绍了将文本文件通过管道传输到gnuplot的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在命令行中,我可以将文本文件的部分数据绘制为:

From command line, I can plot part of the data of a text file as:

回显图\"<猫myfile |awk'{print \ $ 2}'\"| gnuplot -persist

echo "plot \"< cat myfile | awk '{print \$2}'\" | gnuplot -persist

我想制作一个简单的bash脚本(mygnuplot),让我可以这样做:

I would like to make a simple bash script (mygnuplot) that allows me to do:

cat myfile |awk'{print $ 2}'|mygnuplot

cat myfile | awk '{print $2}' | mygnuplot

我已经阅读了所有线程,但仍然没有弄清楚.有人可以告诉我.谢谢,雅各布

I have read all the thread but I still haven't figured it out. Can someone advise me. Thanks, Jacopo

推荐答案

要从stdin中读取数据,请使用-特殊文件名:

To read data from stdin, use the - special filename:

awk '{print $2}' < test.dat | gnuplot -persist -e "plot '-'"

另请参阅帮助特殊文件名.

但是,一般来讲,gnuplot本身就有几种选择列和行的可能性,例如和 using every 一起使用.

But, in general gnuplot has itself several possiblities to select columns and rows e.g. with using and every.

这篇关于将文本文件通过管道传输到gnuplot的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆