How to columnate text with tabs (in vim or on the shell)

Posted by kine on Super User See other posts from Super User or by kine
Published on 2013-10-29T19:59:56Z Indexed on 2013/10/29 22:00 UTC
Read the original article Hit count: 244

Filed under:
|
|
|

I have a frequent need to manually manipulate tab-delimited text for data entry and other purposes, and when i do this it helps if the text is aligned properly into columns. For example (assuming 4-space tabs):

# original format
abcdefghijklmnop    field2
abcdefgh    field2
abcdefghijkl    field2

# ideal format
abcdefghijklmnop    field2
abcdefgh            field2
abcdefghijkl        field2

I am very familiar with using the column utility to columnate text this way, but the problem is that it uses spaces to align the columns, and i specifically need tabs. This requirement also appears to rule out the Tabularize plug-in.

Is there any way that i can columnate text with tabs specifically, either within vim or at the shell? It looks like i might be able to do it with groff/tbl, but honestly i'd rather columnate it by hand than mess with that....

© Super User or respective owner

Related posts about vim

Related posts about shell