I'm using a python script to record data from two temperature sensors to a .csv file. For every reading (every 5 mins) a new line is added to the end of the file. How can I get gnuplot to only use the last 288 lines, so I will end up with a graph for the last 24 hrs?
Thanks!
:Edit:
Got it, thanks for the hint @Istvan Chung.
A simple
plot '< tail -n 288 datafile.csv' using ...
seems to do the trick.
An easy solution here is to use the unix tail
command to select the last 288 lines.
I suggested in a comment that
tail -n 288 <file> | gnuplot -p -e "set datafile separator \",\"; plot '-'"
should work. According to an edit on the original question, the correct syntax here was of the form
plot '< tail -n 288 datafile.csv' using ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With