Question

Is there a way to PRINT: everything on 1 line?

Using:

PRINT:e:LAST:"Current\:%8.2lf" \
PRINT:e:AVERAGE:"Avg\:%8.2lf" \
PRINT:e:MAX:"Max\:%8.2lf \n" \

I get output that looks like:

Current:   32.56
Avg:   44.41
Max:  131.90 \n
Current:   28.15
Avg:   65.33
Max:  389.69 \n
Current:   11.98
Avg:   16.45
Max:   59.42 \n
....

I would like to get it to look like this:

Current:   32.56    Avg:   44.41    Max:  131.90 \n
Current:   28.15    Avg:   65.33    Max:  389.69 \n

In the end this will allow me to format the txt to import into excel.

Is this possible?

Was it helpful?

Solution

No, you cannot do this, as the PRINT directive does not work this way.

While the GPRINT directive allows you to use \l, \r, \c for starting a new line and specifying justification options, the PRINT statement defines a single string. Each of the strings (IE, each PRINT directive) constitutes a new item in the output array, which is printed with one item per line.

If you are calling RRDTool from the API, you get the array of PRINT outputs as an array pointer. This is much more helpful programmatically, but requires some post-processing if you want to do formatting as in your case.

rrdtool graph $OPTIONS | tr '\n' ' ' | sed 's/\\n/\n/g'
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top