Column

From LQWiki
Jump to: navigation, search

column forms a set of columns from the lines in its input. By default the result has as many full rows as possible. Empty lines are ignored by default (but see Options.)

Options

  • -c <number> specify the number of columns
  • -s <separators> specify a set of characters to use with -t
  • -t determine the number of columns in the input delimited by the argument to -s (whitespace by default).
  • -x Have as many full columns as possible.
  • -n Do not merge adjacent delimiters
  • -e Do not ignore empty lines.

Environment

The command is affected by environment variables COLUMNS, LANG, LC_ALL and LC_CTYPE as described in the man page for environ(7).

Example

An example of pretty-printing from the man page:

   (printf "PERM LINKS OWNER GROUP SIZE MONTH DAY HH:MM/YEAR NAME\n" ; \
   ls -l | sed 1d) | column -t

Provided by

Most (all?) Linux distributions incorporate this from the [util-linux] project

See also