发现一个对列排版挺好用的命令:column

help

[root@hdpool1 tmp]# column -h

Usage:
 column [options] [file ...]

Options:
 -c, --columns <width>    width of output in number of characters
 -t, --table              create a table
 -s, --separator <string> possible table delimiters
 -o, --output-separator <string>
                          table output column separator, default is two spaces
 -x, --fillrows           fill rows before columns

 -h, --help     display this help and exit
 -V, --version  output version information and exit

For more details see column(1).

eg.

[root@hdpool1 bin]# cat rds.log | column -t
BackupOssLogSize   :  20062119710
BackupOssDataSize  :  37176230912
DBInstanceId       :  rm-bp10wsh06XXXXXXX
RequestId          :  4FF90B38-CD0E-4B1A-9BCC-62A407827A24
LogSize            :  1078984704
DataSize           :  49582964736
ColdBackupSize     :  -1
SQLSize            :  -1
BackupSize         :  57238350622
DiskUsed           :  50661949440
[root@hdpool1 bin]# 
[root@hdpool1 bin]# 
[root@hdpool1 bin]# cat rds.log | column -s ':' -t
BackupOssLogSize     20062119710
BackupOssDataSize    37176230912
DBInstanceId         rm-bp10wsh06XXXXXXX
RequestId            4FF90B38-CD0E-4B1A-9BCC-62A407827A24
LogSize              1078984704
DataSize             49582964736
ColdBackupSize       -1
SQLSize              -1
BackupSize           57238350622
DiskUsed             50661949440
[root@hdpool1 bin]#

  

原文地址:https://www.cnblogs.com/chenglee/p/11847043.html