As someone else pointed out, this definitely gets points for using sh/awk.
Just wanted to mention that gnuplot also has a "dumb" output option that will generate ascii plots in the terminal. Thay is usually my go-to for this use case.
You would probably need a wrapper script to do this. The script could periodically clear the screen and call "barchart" with the new input data, re-rendering the chart from scratch.
"barchart" is a very simple shell script that doesn't do much on its own.
As an intermediate Linux user I’ve found shell to be both wondrously powerful as well as frustratingly difficult to write.
You can do so much. And the model of chaining known, stable programs together is elegant.
But it feels hard to write and maintain good code with. Even in this barchart program there’s a string of awk within this code.
So it got me wondering: is there any high quality text editor or IDE support for shell scripts? Perhaps one that even understands or looks at the inputs and outputs to other programs and understands hen you’re writing awk or sed or whatnot inside it?
And what about the concept of a higher level ergonomic language that compiles to a shell script?
There exist more modern shells like Fish Shell and Oil Shell. I haven't used them, but they're probably nicer to use than POSIX shell. I'm sure they have pipes and stuff too.
Hi jwmhjwmh - thanks for posting this. I just wanted to add, for me, two important features of a utility like this are 1. to accept input from a pipe, and 2. to specify a delimiter. My usual use would be
data source | processing | plot
E.g. a csv, cut or awk, then either print the data or plot. The features I suggested make this workflow easier, but I don't know how common that is. I'd be interested to know how other people would use this.
on a tangent I was playing with https://github.com/piccolomo/plotext for a bit (especially on a data analysis server connected over ssh it's quite useful, if you don't have the bandwidth to start a jupyter notebook).
Just wanted to mention that gnuplot also has a "dumb" output option that will generate ascii plots in the terminal. Thay is usually my go-to for this use case.