column linux,Linux column命令格式化显示

最近在使用AWK分析所有IP每天的访问数时,默认显示结果只是一个空格隔开,因为不是格式化输出不便于更直观的浏览,最开始尝试用printf感觉很繁琐,而且数据宽度不好预判,后来发现column命令可以比较轻松解决我的问题。

帮助文档 #man columnNAME

column - columnate lists

SYNOPSIS

column [-tx] [-c columns] [-s sep] [file ...]

DESCRIPTION

The column utility formats its input into multiple columns. Rows are filled before columns. Input is taken from file operands, or, by default, from the standard input. Empty lines are ignored.

The options are as follows:

-c Output is formatted for a display columns wide.

-s Specify a set of characters to be used to delimit columns for the -t option.

-t Determine the number of columns the input contains and create a table. Columns are delimited with whitespace, by default, or with the characters supplied using the -s option. Useful for pretty-

printing displays.

-x Fill columns before filling rows.

Column exits 0 on success, >0 if an error occurred.

下面是一个demo:[root@localhost ~]# echo '格式化前' && mount && echo '格式化后' && mount |column -t

column-mount.png

-- The End --

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值