您可能希望使用column
命令,通常使用--table / -t
来生成基本的表格输出:
从手册页:
-t, --table
确定输入包含的列数并创建一个表.默认情况下,列用空格分隔,或使用--output separator选项提供的字符分隔.表格输出对于漂亮的打印很有用.
column -t [file]
# or from stdin
cat file | column -t
# For a quick demonstration, format the output of mount
mount | column -t
column
还有很多其他复杂的 Select .详情见man column
.