tldr/pages/common/column.md

22 lines
748 B
Markdown
Raw Normal View History

2016-09-22 15:20:03 +01:00
# column
> Format `stdin` or a file into multiple columns.
2021-03-31 11:45:02 +01:00
> Columns are filled before rows; the default separator is a whitespace.
> More information: <https://manned.org/column>.
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
- Specify the column delimiter character for the `--table` option (e.g. "," for CSV) (defaults to whitespace):
2021-03-31 11:45:02 +01:00
`printf "header1,header2\nbar,foo\n" | column --table --separator {{,}}`
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`