zoukankan      html  css  js  c++  java
  • linux命令--cat

    cat作用:1.输出文本内容到屏幕   2.输出文本内容到另外一个文件

    参数说明:

    -n:对所有行进行编号

    -b:不对空白行编号

    -s:连续多行空白行显示为单行

    举例说明:

    ---------------------------------------------------

    查看1.txt文本内容 

    [root@test tools]# cat 1.txt
               c

               d
               e


               f

               g

    ---------------------------------------------------

    查看1.txt文本内容,并对所有行进行编号

    [root@test tools]# cat -n 1.txt
              1 c
              2
              3 d
              4 e
              5
              6
              7 f
              8
              9
              10
              11 g

    -----------------------------------------------------

    查看1.txt文本内容,只对非空白行进行编号

    [root@test tools]# cat -b 1.txt 
              1 c

              2 d
              3 e


              4 f

              5 g

    -----------------------------------------------------

    查看1.txt文本内容,连续多行空白行显示为一行

    [root@test tools]# cat -s 1.txt
              c

              d
              e

              f

              g

    -----------------------------------------------------

    将1.txt文本内容,输出到2.txt中,查看2.txt内容

    [root@test tools]# cat 1.txt > 2.txt
    [root@test tools]# cat 2.txt
              c

              d
              e


              f

              g

    -----------------------------------------------------

    欢迎入群交流:573602703

  • 相关阅读:
    APUE_1.7ErrorHandling Figure1.8Demonstrate strerror and perror
    4-7 使用tf.train.slice_input_producer读取列表样本
    Ubuntu16.4+github+pycharm
    4-5 Cifar10数据集解析
    4-6 TF之TFRecord数据打包案例
    matlab如何创建一个视频预览
    Alpha
    如何使用 declare-styleable
    LayoutParams使用
    桌面快捷方式的问题-创建-删除-判断
  • 原文地址:https://www.cnblogs.com/wjunchao/p/5915803.html
Copyright © 2011-2022 走看看