[20191106]善用column格式化输出.txt
2019-11-06 09:39:45来源:博客园 阅读 ()
[20191106]善用column格式化输出.txt
[20191106]善用column格式化输出.txt
# man column
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.
-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.
--//可以利用格式化输出获得好的显示效果,例子如下:
$ mount
/dev/sda1 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
/dev/sda2 on /tmp type ext4 (rw)
/dev/sda5 on /u01 type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
--//mount的显示连接在一起,不好查看.而假如column -t
$ mount | column -t
/dev/sda1 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
/dev/sda2 on /tmp type ext4 (rw)
/dev/sda5 on /u01 type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
--//这样就好看了.再比如:
# ss -nop
--//显示太宽了.不贴出结果.而加入column -t过滤,显示如下:
# ss -nop | column -t
State Recv-Q Send-Q Local Address:Port Peer Address:Port
ESTAB 0 0 192.168.100.78:1521 192.168.100.78:23591 timer:(keepalive,4.213ms,0) users:(("tnslsnr",29630,12))
ESTAB 0 0 192.168.100.78:23591 192.168.100.78:1521 users:(("oracle",54271,10))
ESTAB 0 44 192.168.100.78:22 192.168.98.6:53411 timer:(on,402ms,0) users:(("sshd",45671,3))
ESTAB 0 0 192.168.100.78:12260 192.168.100.78:1521 users:(("oracle",57162,10))
ESTAB 0 0 192.168.100.78:22 192.168.98.6:51190 timer:(keepalive,50sec,0) users:(("sshd",45348,3))
ESTAB 0 0 192.168.100.78:1521 192.168.100.78:12260 timer:(keepalive,33sec,0) users:(("tnslsnr",29630,13))
--//这样就好看许多.
原文链接:https://www.cnblogs.com/lfree/p/11803191.html
如有疑问请与原作者联系
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash