Chinaunix首页 | 论坛 | 博客
  • 博客访问: 5717300
  • 博文数量: 409
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 8273
  • 用 户 组: 普通用户
  • 注册时间: 2013-10-23 19:15
个人简介

qq:78080458 学习交流群:150633458

文章分类

全部博文(409)

文章存档

2019年(127)

2018年(130)

2016年(20)

2015年(60)

2014年(41)

2013年(31)

分类: LINUX

2019-01-10 06:51:32

col

过滤掉影响阅读的控制字符,使用重定向符把说明手册的内容输出到文本文件时,控制字符就成乱码。col指令可以过滤掉控制字符,使文本可读。col从标砖输入读取内容,输出到标准输出。col在读取字符时跟踪字符集,并确保字符集在输出时是正确的。如果输入试图备份到最后一条刷新行,col将显示一条警告消息。

此命令的适用范围:RedHatRHELUbuntuCentOSSUSEopenSUSEFedora

1、语法

col [-bfpx]  [-lnum] file

 

2、选项列表

选项

说明

--version

显示命令版本信息

--help

显示帮助文档

-b

过滤所有的控制字符

-f

过滤掉RLF字符,忽略HRLF字符

-p

忽略未知的控制字符

-x

将多个空格用tab代替

-lnum

设置缓冲区大小,默认128

 

3、实例

clear指令的手册经过过滤,输出到文本文件

[root@192 weijie]# man clear > 3.c                  //将手册从定向到文件

[root@192 weijie]# vim 3.c                            //编辑文件,内部有很多乱码,这些都是控制字符

clear(1)                                                             clear(1)

N^HNA^HAM^HME^HE

       c^Hcl^Hle^Hea^Har^Hr - clear the terminal screen

 

S^HSY^HYN^HNO^HOP^HPS^HSI^HIS^HS

       c^Hcl^Hle^Hea^Har^Hr

 

D^HDE^HES^HSC^HCR^HRI^HIP^HPT^HTI^HIO^HON^HN

       c^Hcl^Hle^Hea^Har^Hr clears your screen if this is possible.  It looks in the environ-

       ment for the terminal type and then in the t^Hte^Her^Hrm^Hmi^Hin^Hnf^Hfo^Ho database to  figure

out how to clear the screen.

 

[root@192 weijie]# man clear | col -b > 3.c                //将手册内容过滤之后,定向到文件

[root@192 weijie]# vim 3.c                                    //编辑文件内容,没有乱码

clear(1)                                                             clear(1)

NAME

clear - clear the terminal screen

 

SYNOPSIS

clear

 

DESCRIPTION

       clear clears your screen if this is possible.  It looks in the environ-

       ment for the terminal type and then in the terminfo database to  figure

       out how to clear the screen.

     

 

阅读(31107) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~