2

I'd like to tabularize a file with the column command:

$ column -c 60 file.txt

The output is nice on the screen, but unusable for my purposes because the items are seperated by tabs. for further processing, I need them as whitespace.

Of course, I cannot just replace one tab with one space because this would destroy the left-alignment of the 2nd, 3rd etc column.

5
  • 2
    expand from GNU coreutils converts tabs to spaces. There are many other ways, f.i. using Vim. Feb 16, 2017 at 6:26
  • 1
    You did see the -s option in the manpage, did you?
    – Murphy
    Feb 16, 2017 at 8:58
  • Yes, I did. In mine, it says Specify a set of characters to be used to delimit columns for the -t option.. Feb 16, 2017 at 9:37
  • 1
    As you didn't give any examples of input and expected output, this may be what you need, or not. For me, column -t -s ' ' works insofar as it uses spaces instead of tabs as column separators. As the manpage describes: "-t [...] Useful for pretty-printing displays.".
    – Murphy
    Feb 16, 2017 at 10:12
  • Yes, -s works well with -t but I am not asking for input seperators, but for output seperators. Apologies if my question was not clear. Feb 16, 2017 at 14:39

1 Answer 1

3

Surely this is as simple as mentioned in the first comment. But here it is, spelled out:

column -c 60 file.txt | expand

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .