将文本文件通过管道传输到gnuplot [英] Pipe a text file to 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屋!