Tony7682
April 27th, 2009, 04:51 AM
Hi,
I am a new here. I did read the FAQ. I had a specific question about piping data to GNU Plot as part of a bash script.
What I am doing is the following: cat'ing out the contents of an mgen (http://cs.itd.nrl.navy.mil/work/mgen/) log file, piping that to trpr (http://pf.itd.nrl.navy.mil/protools/trpr.html) (which processes the mgen results into gnuplot-readable format), and then piping that output to gnuplot.
Here is the bash script I am running:
for i in $(seq 1 180)
do
sleep 10
if [ `expr $i % 6` -ne 0 ]; then
# show snapshot
cat $MGLOGFILE | trpr drec real auto X | gnuplot -noraise -persist
if [ -f $PLOTFILE ]; then
rm -vf $PLOTFILE
fi
else
# show cumulative results
cat $MGLOGFILE | trpr drec auto X output $PLOTFILE && gnuplot -noraise -persist $PLOTFILE
fi
done
(I've tried piping tail -f output instead of cat output to trpr, but that would not work for some reason.)
The above seems to be working ok except for one thing: Each call to the cat | trpr | gnuplot line (bolded above) causes a new, separate gnuplot window to open. What I would like is for each successive call to that line to direct its output to the same gnuplot. That way, I don't have a new gnuplot window popping up every 10 seconds.
My workaround right now is to have a wrapper script that periodically closes any gnuplot windows. I'd rather avoid having to do that, though.
Anyone know how to keep continually writing (and rewriting) to one gnuplot window?
I am a new here. I did read the FAQ. I had a specific question about piping data to GNU Plot as part of a bash script.
What I am doing is the following: cat'ing out the contents of an mgen (http://cs.itd.nrl.navy.mil/work/mgen/) log file, piping that to trpr (http://pf.itd.nrl.navy.mil/protools/trpr.html) (which processes the mgen results into gnuplot-readable format), and then piping that output to gnuplot.
Here is the bash script I am running:
for i in $(seq 1 180)
do
sleep 10
if [ `expr $i % 6` -ne 0 ]; then
# show snapshot
cat $MGLOGFILE | trpr drec real auto X | gnuplot -noraise -persist
if [ -f $PLOTFILE ]; then
rm -vf $PLOTFILE
fi
else
# show cumulative results
cat $MGLOGFILE | trpr drec auto X output $PLOTFILE && gnuplot -noraise -persist $PLOTFILE
fi
done
(I've tried piping tail -f output instead of cat output to trpr, but that would not work for some reason.)
The above seems to be working ok except for one thing: Each call to the cat | trpr | gnuplot line (bolded above) causes a new, separate gnuplot window to open. What I would like is for each successive call to that line to direct its output to the same gnuplot. That way, I don't have a new gnuplot window popping up every 10 seconds.
My workaround right now is to have a wrapper script that periodically closes any gnuplot windows. I'd rather avoid having to do that, though.
Anyone know how to keep continually writing (and rewriting) to one gnuplot window?