Pipe a text file to gnuplot

喜欢而已 提交于 2019-12-13 19:40:46

问题


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

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

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

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


回答1:


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

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

See also help special-filenames.

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



来源:https://stackoverflow.com/questions/21994606/pipe-a-text-file-to-gnuplot

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!