问题
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