2016-09-22 15:20:03 +01:00
|
|
|
# column
|
|
|
|
|
2021-03-31 11:45:02 +01:00
|
|
|
> Format standard input or a file into multiple columns.
|
|
|
|
> Columns are filled before rows; the default separator is a whitespace.
|
|
|
|
> More information: <https://man.archlinux.org/man/core/util-linux/column.1>.
|
2016-09-22 15:20:03 +01:00
|
|
|
|
2021-03-31 11:45:02 +01:00
|
|
|
- Format the output of a command for a 30 characters wide display:
|
2016-09-22 15:20:03 +01:00
|
|
|
|
2021-03-31 11:45:02 +01:00
|
|
|
`printf "header1 header2\nbar foo\n" | column --output-width {{30}}`
|
2016-09-22 15:20:03 +01:00
|
|
|
|
2021-03-31 11:45:02 +01:00
|
|
|
- Split columns automatically and auto-align them in a tabular format:
|
2016-09-22 15:20:03 +01:00
|
|
|
|
2021-03-31 11:45:02 +01:00
|
|
|
`printf "header1 header2\nbar foo\n" | column --table`
|
2016-09-22 15:20:03 +01:00
|
|
|
|
2021-03-31 11:45:02 +01:00
|
|
|
- Specify the column delimiter character for the `--table` option (e.g. "," for csv) (defauls to whitespace):
|
2019-05-16 21:46:41 +01:00
|
|
|
|
2021-03-31 11:45:02 +01:00
|
|
|
`printf "header1,header2\nbar,foo\n" | column --table --separator {{,}}`
|
2019-05-16 21:46:41 +01:00
|
|
|
|
2021-03-31 11:45:02 +01:00
|
|
|
- Fill rows before filling columns:
|
2016-09-22 15:20:03 +01:00
|
|
|
|
2021-03-31 11:45:02 +01:00
|
|
|
`printf "header1\nbar\nfoobar\n" | column --output-width {{30}} --fillrows`
|