nferraz/st

Default number formatting doesn't align properly

eliasdorneles opened this issue · 2 comments

Steps to reproduce:

  1. Download example file from: http://pastie.org/10479974 and put it in /tmp/test-input.txt

  2. Run:

$ st /tmp/test-input.txt
N   min max sum mean    stddev
1000    404 52092   2.38715e+06 2387.15 3356.8

Note how the mean doesn't align automatically with its value because the formatted sum is very long.

@eliasdorneles The default output is tab-separated and will be formatted correctly where tabs are used (if spaces were used it would be harder to dump into spreadsheets, etc.)

I agree that it might be useful to have a mode which formats using spaces, but in the meantime you can use the column tool:

Compare:

$ st mydata.log # tab-separated output
N	min	max	sum	mean	stddev
5000	43	2111	2.60967e+06	521.934	248.823

with

$ st mydata.log | column -t # aligned column output
N     min  max   sum          mean     stddev
5000  43   2111  2.60967e+06  521.934  248.823

You can also use the --transverse option to make the output easier to read:

$ seq 1 1000 | st --transverse
N	1000
min	1
max	1000
sum	500500
mean	500.5
stddev	288.819