News for hackers. Stuff that matters.
Re:Basic Scripting with Awk and Gnuplot by dan-robertson on Thursday January 21, 2021 @08:18PM (#25867020)
Beware when piping awk | gnuplot or especially awk | awk: when printing numbers, awk by default prints them with something like %.6g, which can lose important amounts of precision. There are two ways this can happen. Firstly when numbers are implicitly converted to strings, eg for concatenation; and secondly when they are printed directly. These conversations are controlled by two different variables which may be set to printf directives to get higher precision.
Re:Basic Scripting with Awk and Gnuplot by FlyMoreRockets on Thursday January 21, 2021 @04:47PM (#25864794)
I note with interest the article links to: https://ferd.ca/awk-in-20-minutes.html

Very succinct quickstart guide.

Re:Basic Scripting with Awk and Gnuplot by EarthIsHome on Thursday January 21, 2021 @06:37PM (#25866215)
I want to use gnuplot more, but I generally find myself spending too much time messing with the plot styles to get something I sort of like.

Can anyone point to some pretty styles they've come across?

Here is one I used a while ago: Pretty Plots with Gnuplot [0]

[0]: https://edg.uchicago.edu/tutorials/pretty_plots_with_gnuplot...

Re:Basic Scripting with Awk and Gnuplot by andrepd on Thursday January 21, 2021 @07:14PM (#25866570)
Some problems: the colours are not that great, and also not colourblind-safe. And most grating of all: why are the tics light gray and not black! It's very hard to read.
Re:Basic Scripting with Awk and Gnuplot by tyingq on Thursday January 21, 2021 @07:12PM (#25866545)
Re:Basic Scripting with Awk and Gnuplot by hatmatrix on Friday January 22, 2021 @05:58AM (#25870542)
Just curious but why go for gnuplot (and awk) rather than python or R? At some point you run up to some limit where you want a bit more capability. I don't know that the learning curve is that much less for awk + gnuplot?
Re:Basic Scripting with Awk and Gnuplot by leephillips on Friday January 22, 2021 @08:35AM (#25871506)
Gnuplot (and awk) have several advantages. It’s faster, especially for large datasets; it’s language-independent and can be used through pipes with any language, so the plotting solution you develop can go with you as you change your simulation language; it’s designed to be automated, plot over the network, etc.
Re:Basic Scripting with Awk and Gnuplot by yiyus on Thursday January 21, 2021 @06:40PM (#25866247)
There is no need to initialize variables with -v. You could just do:

    awk '/Time/{printf("%d %s ", ++j, $3)} ...
Re:Basic Scripting with Awk and Gnuplot by tragomaskhalos on Friday January 22, 2021 @03:50AM (#25869723)
Or use a begin block: 'BEGIN { j = 1 } /Time/ … '

I find it best to restrict the use -v to injecting environment variables into my awk scripts.