[root@www ~]# expand [-t] file
选项与参数:
-t :后面可以接数字。一般来说,一个 tab 按键可以用 8 个空格键取代。
我们也可以自行定义一个 [tab] 按键代表多少个字符呢!

[root@www ~]# col [-xb]
选项与参数:
-x :将 tab 键转换成对等的空格键
-b :在文字内有反斜杠 (/) 时,仅保留反斜杠最后接的那个字符

 

  1. [root@localhost ~]# grep "^MANPATH" /etc/man.config | cat -A 
  2. MANPATH^I/usr/man$ 
  3. MANPATH^I/usr/share/man$ 
  4. MANPATH^I/usr/local/man$ 
  5. MANPATH^I/usr/local/share/man$ 
  6. MANPATH^I/usr/X11R6/man$ 
  7. MANPATH_MAP^I/bin^I^I^I/usr/share/man$ 
  8. MANPATH_MAP^I/sbin^I^I^I/usr/share/man$ 
  9. MANPATH_MAP^I/usr/bin^I^I/usr/share/man$ 
  10. MANPATH_MAP^I/usr/sbin^I^I/usr/share/man$ 
  11. MANPATH_MAP^I/usr/local/bin^I^I/usr/local/share/man$ 
  12. MANPATH_MAP^I/usr/local/sbin^I^I/usr/local/share/man$ 
  13. MANPATH_MAP^I/usr/X11R6/bin^I^I/usr/X11R6/man$ 
  14. MANPATH_MAP^I/usr/bin/X11^I^I/usr/X11R6/man$ 
  15. MANPATH_MAP^I/usr/bin/mh^I^I/usr/share/man$ 

//使用expand替换制表符为5个空格

  1. [root@localhost ~]# grep "^MANPATH" /etc/man.config | expand -t 5  | cat -A 
  2. MANPATH   /usr/man$ 
  3. MANPATH   /usr/share/man$ 
  4. MANPATH   /usr/local/man$ 
  5. MANPATH   /usr/local/share/man$ 
  6. MANPATH   /usr/X11R6/man$ 
  7. MANPATH_MAP    /bin           /usr/share/man$ 
  8. MANPATH_MAP    /sbin               /usr/share/man$ 
  9. MANPATH_MAP    /usr/bin       /usr/share/man$ 
  10. MANPATH_MAP    /usr/sbin      /usr/share/man$ 
  11. MANPATH_MAP    /usr/local/bin      /usr/local/share/man$ 
  12. MANPATH_MAP    /usr/local/sbin          /usr/local/share/man$ 
  13. MANPATH_MAP    /usr/X11R6/bin      /usr/X11R6/man$ 
  14. MANPATH_MAP    /usr/bin/X11        /usr/X11R6/man$ 
  15. MANPATH_MAP    /usr/bin/mh         /usr/share/man$ 

//使用col替换制表符为相等长度空格

  1. [root@localhost ~]# grep "^MANPATH" /etc/man.config | col -x  | cat -A 
  2. MANPATH /usr/man$ 
  3. MANPATH /usr/share/man$ 
  4. MANPATH /usr/local/man$ 
  5. MANPATH /usr/local/share/man$ 
  6. MANPATH /usr/X11R6/man$ 
  7. MANPATH_MAP     /bin                    /usr/share/man$ 
  8. MANPATH_MAP     /sbin                   /usr/share/man$ 
  9. MANPATH_MAP     /usr/bin                /usr/share/man$ 
  10. MANPATH_MAP     /usr/sbin               /usr/share/man$ 
  11. MANPATH_MAP     /usr/local/bin          /usr/local/share/man$ 
  12. MANPATH_MAP     /usr/local/sbin         /usr/local/share/man$ 
  13. MANPATH_MAP     /usr/X11R6/bin          /usr/X11R6/man$ 
  14. MANPATH_MAP     /usr/bin/X11            /usr/X11R6/man$ 
  15. MANPATH_MAP     /usr/bin/mh             /usr/share/man$