zoukankan      html  css  js  c++  java
  • Linux基础命令---文本过滤coi

    col

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

           此命令的适用范围:RedHat、RHEL、Ubuntu、CentOS、SUSE、openSUSE、Fedora。

    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.

         

  • 相关阅读:
    互联网、云大数据相关书籍推荐
    育儿、教育书籍推荐
    MySQL客户端工具的选择
    解决Windows10或者其他版本Windows Update报错的问题
    启动Myeclipse报错“Failed to create the Java Virtual Machine”的解决办法
    mysql的日期存储字段比较int,datetime,timestamp区别
    nginx增加ssl服务方法
    mysql导入出现MySQL Error 1153
    mysql忘记密码修改方法
    清空本地ssh记录数据,ssh: connect to host Ip port 22: Connection refused
  • 原文地址:https://www.cnblogs.com/wj78080458/p/10179240.html
Copyright © 2011-2022 走看看