[root@www ~]# expand [-t] file
选项与参数:
-t :后面可以接数字。一般来说,一个 tab 按键可以用 8 个空格键取代。
我们也可以自行定义一个 [tab] 按键代表多少个字符呢!
[root@www ~]# col [-xb]
选项与参数:
-x :将 tab 键转换成对等的空格键
-b :在文字内有反斜杠 (/) 时,仅保留反斜杠最后接的那个字符
- [root@localhost ~]# grep "^MANPATH" /etc/man.config | cat -A
- MANPATH^I/usr/man$
- MANPATH^I/usr/share/man$
- MANPATH^I/usr/local/man$
- MANPATH^I/usr/local/share/man$
- MANPATH^I/usr/X11R6/man$
- MANPATH_MAP^I/bin^I^I^I/usr/share/man$
- MANPATH_MAP^I/sbin^I^I^I/usr/share/man$
- MANPATH_MAP^I/usr/bin^I^I/usr/share/man$
- MANPATH_MAP^I/usr/sbin^I^I/usr/share/man$
- MANPATH_MAP^I/usr/local/bin^I^I/usr/local/share/man$
- MANPATH_MAP^I/usr/local/sbin^I^I/usr/local/share/man$
- MANPATH_MAP^I/usr/X11R6/bin^I^I/usr/X11R6/man$
- MANPATH_MAP^I/usr/bin/X11^I^I/usr/X11R6/man$
- MANPATH_MAP^I/usr/bin/mh^I^I/usr/share/man$
//使用expand替换制表符为5个空格
- [root@localhost ~]# grep "^MANPATH" /etc/man.config | expand -t 5 | cat -A
- MANPATH /usr/man$
- MANPATH /usr/share/man$
- MANPATH /usr/local/man$
- MANPATH /usr/local/share/man$
- MANPATH /usr/X11R6/man$
- MANPATH_MAP /bin /usr/share/man$
- MANPATH_MAP /sbin /usr/share/man$
- MANPATH_MAP /usr/bin /usr/share/man$
- MANPATH_MAP /usr/sbin /usr/share/man$
- MANPATH_MAP /usr/local/bin /usr/local/share/man$
- MANPATH_MAP /usr/local/sbin /usr/local/share/man$
- MANPATH_MAP /usr/X11R6/bin /usr/X11R6/man$
- MANPATH_MAP /usr/bin/X11 /usr/X11R6/man$
- MANPATH_MAP /usr/bin/mh /usr/share/man$
//使用col替换制表符为相等长度空格
- [root@localhost ~]# grep "^MANPATH" /etc/man.config | col -x | cat -A
- MANPATH /usr/man$
- MANPATH /usr/share/man$
- MANPATH /usr/local/man$
- MANPATH /usr/local/share/man$
- MANPATH /usr/X11R6/man$
- MANPATH_MAP /bin /usr/share/man$
- MANPATH_MAP /sbin /usr/share/man$
- MANPATH_MAP /usr/bin /usr/share/man$
- MANPATH_MAP /usr/sbin /usr/share/man$
- MANPATH_MAP /usr/local/bin /usr/local/share/man$
- MANPATH_MAP /usr/local/sbin /usr/local/share/man$
- MANPATH_MAP /usr/X11R6/bin /usr/X11R6/man$
- MANPATH_MAP /usr/bin/X11 /usr/X11R6/man$
- MANPATH_MAP /usr/bin/mh /usr/share/man$