发现一个对列排版挺好用的命令:column
help
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | [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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | [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] # |