LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (https://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   Patterns as GNUplot datafile separators? (https://www.linuxquestions.org/questions/linux-desktop-74/patterns-as-gnuplot-datafile-separators-4175675401/)

Turbocapitalist 05-17-2020 01:40 AM

Patterns as GNUplot datafile separators?
 
In GNUplot, it is possible to set the delimiter for the input data to any single character by setting the datafile separator. I am wondering if it is possible to have it deal with a variable span of characters or even a fancier patter. The following built-in option allows it to deal with any single whitespace character,

Code:

set datafile separator whitespace
but it too chokes on multiple instances of that character. So gnuplot handles the first line below just fine, but treats the second line as if the fourth column were missing:

Code:

2020-05-17 06:35 20.812 21.937
2020-05-17 06:38 20.8  21.932

I could modify the way that input file is generated, but then it wrecks the visual flow in another conted. So, without resorting to pre-processing the data file, is there a way to get GNUplot to allow patters as data file separators?

shruggy 05-17-2020 03:31 AM

Well, there's a possibility to invoke awk from inside GNUplot. Does it count as preprocessing?

Turbocapitalist 05-17-2020 06:42 AM

Very interesting. Piped-data for gnuplot is buried deep down in the gnuplot manual and I would not have seen that section otherwise. Thanks. I wish that their manual was HTML too not just PDF.

However, looking at the two scripts and four files involved, I think it'll just be better to adjust my workflow a little for now. I see some big changes which I can make but will procrastinate on refactoring for a while longer and just make a few tweaks instead.


All times are GMT -5. The time now is 05:54 PM.