1

I would like to apply some options of the column command of the util-linux to all my columns. I'm particularly interested in the --table-right, it works if a pass the number of the column. But I would like to pass a set and possibly even all.

http://man7.org/linux/man-pages/man1/column.1.html

thanks

edit

I found that column doesn't raise any error when passing a range of columns (i.e., 1,2,3,4,etc.) that doesn't match the number of columns in the file. Therefore, it is possible to use seq to make a default range and then pass it to columns.

column -t -s , -o ",  " -R $(seq -s , 1 1 50) file.csv

I'm accepting the answer as I think my question can either be solved with a feature request, as suggested, or with seq as above here.

1
  • IMHO you should post your edit as an answer Feb 2 '20 at 3:15
1

This bit in the man page states:

OPTIONS         
       The argument columns for --table-* options is comma separated list of
       the column names as defined by --table-columns or it's column number
       in order as specified by input. It's possible to mix names and
       numbers.

to create a comma separated list of names and numbers. The man page does not list any shortcuts. You could try asking for a feature request on the github page.

And provides an example in the form of 2 options:

sed 's/#.*//' /etc/fstab | column --table --table-columns 
SOURCE,TARGET,TYPE,OPTIONS,PASS,FREQ --table-right PASS,FREQ

You will need to write them all out as a list of numbers or list of names.

Mind that "util-linux" is not installed in Ubuntu by default. We use "BSD mainutils". Ours has less options.

1
  • Thanks, you are right about the util-linux, I compiled it and didn't realize that this makes my question kind of misplaced here. I found that seq may solve my problems at the moment, but thanks for suggesting the feature request, I'll think about it.
    – Peruz
    Feb 2 '20 at 2:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.