I have a tab delimited text file that I send to column for a "beautiful print" table.
Original file:
1<TAB>blablablabla<TAB>aaaa bbb ccc 2<TAB>blabla<TAB>xxxxxx 34<TAB>okokokok<TAB>zzz yyy
Using column -s$'\t' -t <original file> , I get
1 blablablabla aaaa bbb xxx 2 blabla xxxxxx 34 okokokok zzz yyy
optional. Now I want to add colors to the columns. I tried adding escape codes around each tab delimited field in the source file. column prints successfully in color, but the columns are no longer aligned. Instead, it simply prints the TAB delimiters verbatim.
Question: how can I get column alignment, but also with unique colors?
I thought of two ways to achieve this:
- Adjust
column parameters to align with color codes. - Redirect the output of the column to another file and perform a search + replace in the first two fields with a space (the first two columns are guaranteed not to contain spaces, and the third column will most likely contain spaces, but not TAB characters)
The problem is that I'm not sure how to do either of these two ...
For reference, here is what I go to column :

Note that the fields are indeed separated by TAB characters. I confirmed this with od .
edit:
It seems like no problem with the coloring. I already have the file shown above with working color codes. Problem: column will not be aligned as soon as I send it using escape codes. I am thinking of passing colors without color codes for column , and then copying the exact number of column spaces displayed between each field and using this in a beautiful print scheme. A.
unix bash escaping multiple-columns
Evan w
source share