(转)[小工具] Linux下列格式化工具 - column
当你看到Linux下命令输出的列歪歪扭扭时,是不是看着很不爽?column 命令就可以方便地解决这个问题。
比如:
我们一般就只用到上面这一个用法。
column的其他用法如下:
|
选项
|
含义
|
| -c 字符数 | 指定显示的列宽 |
| -s“ 分隔符 “ | 使用-t选项时,指定分隔符(允许指定多个分隔符) |
| -t | 判断输入行的列数来创建一个表。分隔符是使用在-s中指定的字符。如果没有指定分隔符,默认是空格 |
| -x | 更改排列顺序(左→右)。默认的顺序为(上→下) |
实例
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
[root@uyhd000225 ~]# mount/dev/hda1 on / type ext3 (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/xvdb1 on /data type ext3 (rw)none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)[root@uyhd000225 ~]# mount |column -t/dev/hda1 on / type ext3 (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/xvdb1 on /data type ext3 (rw)none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw) |
解释-s选项:
我以为-s选项是输出分隔符,比如上面,我是用如下命令:
|
1
2
3
4
5
6
7
8
9
|
[root@uyhd000225 ms]# mount |column -s '@' -t/dev/hda1 on / type ext3 (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/xvdb1 on /data type ext3 (rw)none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)[root@uyhd000225 ms]# |
我以为他会输出以@为分隔符,但是没有安装我的期望输出
man column没有详细说明使用方法,info column也没有:
google发现他是输出分隔符,使用方法如下
|
1
2
3
4
5
6
7
8
|
[root@uyhd000225 testDir]# cat testcolumnJackie | 18 | maleHelen | 20 | femaleDaniel Liu | 23 | male[root@uyhd000225 testDir]# cat testcolumn | column -s '|' -tJackie 18 maleHelen 20 femaleDaniel Liu 23 male |
(转)[小工具] Linux下列格式化工具 - column的更多相关文章
- Linux系统状态监控小工具 - Linux Dash
Linux Dash是一个简单易用的Linux系统状态监控工具,项目地址:https://github.com/afaqurk/linux-dash 1.安装Apache服务: [root@local ...
- Linux下列格式化工具 - column
[root@localhost ~]# mount/dev/sda2 on / type ext4 (rw)proc on /proc type proc (rw)sysfs on /sys type ...
- linux运维自动化shell脚本小工具
linux运维shell 脚本小工具,如要分享此文章,请注明文章出处,以下脚本仅供参考,若放置在服务器上出错,后果请自负 1.检测cpu剩余百分比 #!/bin/bash #Inspect CPU # ...
- Linux下安装setup tools小工具
1, 最小化的linux系统(centos\redhat)默认都是没有安装setup图形小工具的,你输入setup命令会提示 command not found . 如果要使用这个命令安装方法 1.安 ...
- linux相关小工具的使用(一)————代码相关工具
在linux环境下,对于程序员来说,知道使用一些好用的小工具,对源代码的阅读.编译和调试都有着事半功倍的效果,这里我也是边学边写的原则,把自己知道的一丁点小知识分享给大家. 一. 源代码的阅读 首先 ...
- dtach-linux-分离功能-小工具 - 点点滴滴 Linux | 点点滴滴 Linux
dtach-linux-分离功能-小工具 - 点点滴滴 Linux | 点点滴滴 Linux dtach-linux-分离功能-小工具 2013年05月20日 ⁄ Linux工具 ⁄ 共 1775字 ...
- 安装linux下面用来配置网络,防火墙,系统服务等设置的图形小工具Setup
Setup命令是linux下面用来配置网络,防火墙,系统服务等设置的图形小工具.使用起来非常方便简单,可是centos\redhat最小化安装之后发现setup命令工具用不了. 接下来介绍如何安装se ...
- linux下好玩或者好用的小工具
本篇文章用于记录自己认为很好玩的linux下的小工具,不断添加中..大家如果有什么好玩的小工具的话,欢迎留言告诉我. 1. cmatrix工具 功能介绍: 可以产生黑客帝国中字符满屏幕飞的效果,当你离 ...
- 初学Python-搞了一个linux用户登录监测小工具
这几天突发奇想,想学习一下Python.看了点基础,觉得有点枯燥,所以想搞点什么.想了想,就随便弄个检测Linux用户登录的小工具吧~ 首先,明确一下功能: 1.能够捕获 linux 用户登录的信息. ...
随机推荐
- 密码分析:使用 Ettercap 和 它的 ARP 毒化功能来嗅探流量
vim /etc/etterconf 将 ec_uid 和 ec_gid 改为 0 需要取消下面的 IPTABLES 行的注释.它在靠近文件末尾的 LINUX 一节 ettercap -G Shift ...
- VR眼镜和AR眼镜的区别
VR眼镜是纯虚拟的世界建模,不结合现实世界.(VR一体机和手机VR眼镜是不同的,不只是是不是以手机为载体播放器的问题,而是它们结构上也有很大的区别:另外还有一点就是电脑端VR,这个主要是游戏:http ...
- Configuring Oracle E-Business Suite Integrated SOA Gateway Release 12.1.2 and Release 12.1.3 in a Multinode Environment (Doc ID 1081100.1)
Configuring Oracle E-Business Suite Integrated SOA Gateway Release 12.1.2 and Release 12.1.3 in a Mu ...
- [翻译]Component Registration in Script System 在脚本系统中注册组件
Component Registration in Script System 在脚本系统中注册组件 To refer to our component from a script, the cl ...
- Android-自定义开关
效果图: 需要两张图片,一张图片为背景,一张图片为滑动的点 布局去指定一个自定义View对象: view.custom.shangguigucustomview.MyCustomSwitch < ...
- Mysql部署
1. 下载 Mysql 版本为: mysql-5.6.43-linux-glibc2.12-x86_64.tar.gz (注意:下载二进制文件)  存放位置: /usr/local 2. 检查机器上 ...
- Unity3d发布的iOS产品中使用GB2312字符编码(CP936)
最近在开发中要用到GB2312字符编码(CP936),在C#代码中便有了如此代码 System.Text.Encoding.GetEncoding() 这在Unity3d 编辑器下运行没有任何问题,打 ...
- wp8.1 调用智慧天气SmartWeatherAPI
在调用api应用的过程,我们需要用hmac加密技术,它是一种基于hash的加密算法,通过一个双方共同约定的密钥,在发送message前,对密钥进行了sha散列计算,在生成消息又对此密钥进行了二次加密, ...
- 用canvas画布画一个画板
前段时间,在对H5的回顾中突然对canvas有了感觉,闲来无事便对其进行了一些捯饬.这不,上周我还做了一个好玩的画板呢,废话不多说,直接上代码(PS:翠花,上代码~): HTML部分: <!DO ...
- MVC中控制器向视图传值的四种方式
MVC中的控制器向视图传值有四种方式分别是 1 ViewDate 2.ViewBag 3.TempDate 4.Model 下面分别介绍四种传值方式 首先先显示出控制器中的代码 using S ...