歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> 學習Linux >> linux命令--cat,linux--cat

linux命令--cat,linux--cat

日期:2017/3/3 18:11:11   编辑:學習Linux

linux命令--cat,linux--cat

linux命令--cat,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

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

http://xxxxxx/Linuxjc/1161734.html TechArticle

Copyright © Linux教程網 All Rights Reserved