columns are not properly aligned
Bug #1644703 reported by
Rolf Leggewie
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
datamash (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Running datamash version 1.0.7-1 on Ubuntu trusty here. The output columns are not properly aligned (using "datamash -g 2 min 3 max 3 < /usr/share/
To post a comment you must log in.
Hello,
(I'm datamash's developer).
This is not a bug but intended operation: the 'scores.txt' is a tab-separated file.
datamash maintains the tabs as in the input - this is how it should be.
The output is not aligned on the terminal because some lines contain long text (longer than 8 characters) which then push the tab output to the next 'column'.
It is equivalent to the following situation:
$ printf "a\t1\nvery- long-text\ t2\n"
a 1
very-long-text 2
You can observe this with 'cat -A' (which displays tabs as '^I'):
$ datamash -g 2 min 3 max 3 < scores.txt | cat -A Medicine^ I72^I100$ Sciences^ I27^I90$ Sciences^ I14^I91$ I39^I99$
Arts^I46^I88$
Business^I79^I94$
Health-
Social-
Life-
Engineering^
If you want to align tab-separated values properly on the screen, use 'expand':
$ datamash -g 2 min 3 max 3 < scores.txt | expand -t20,30
Arts 46 88
Business 79 94
Health-Medicine 72 100
Social-Sciences 27 90
Life-Sciences 14 91
Engineering 39 99
regards,
- assaf