Linux command
column 命令
文本
涉及管道、覆盖或删除,执行前请先确认路径和参数。
常用示例
Example
printf "header1 header2\nbar foo\n" | column -c 30
Auto-align
printf "header1 header2\nbar foo\n" | column -t
Example
printf "header1,header2\nbar,foo\n" | column -t -s ,
Example
printf "header1\nbar\nfoobar\n" | column -c 30 -x
说明
column formats text from stdin or a file into multiple columns. By default, columns are filled before rows using whitespace as separator. The table mode (-t) is particularly useful for aligning structured data into readable tables.
参数
- -c, --output-width _width_
- Output width in characters
- -t, --table
- Create a table with aligned columns
- -s, --separator _chars_
- Column delimiters for table mode (default: whitespace)
- -x, --fillrows
- Fill rows before filling columns
- -o, --output-separator _string_
- Table output column separator
FAQ
What is the column command used for?
column formats text from stdin or a file into multiple columns. By default, columns are filled before rows using whitespace as separator. The table mode (-t) is particularly useful for aligning structured data into readable tables.
How do I run a basic column example?
Run `printf "header1 header2\nbar foo\n" | column -c 30` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -c, --output-width _width_ do in column?
Output width in characters