中文字幕亚洲第一精品|精品国产免费一区二区|久久婷婷五月六月综合版|中文字幕熟妇久久久人妻|久久综合精品国产一区无码|国产成人精品永久免费视频|午夜亚洲国产精品理论片a级|久久精品一区二区三区无码护土

 訪問手機(jī)版  

Linux常用命令|Linux培訓(xùn)學(xué)習(xí)|考試認(rèn)證|工資待遇與招聘,認(rèn)準(zhǔn)超級(jí)網(wǎng)工!

招聘|合作 登陸|注冊(cè)

網(wǎng)絡(luò)工程師培訓(xùn)

當(dāng)前位置:網(wǎng)絡(luò)工程師 > 技術(shù)課程 > linux > 熱點(diǎn)關(guān)注 > linux常用命令

linux常用命令 linux下cat命令詳解|Linux cat命令詳解

時(shí)間:2018-09-30

3.將幾個(gè)文件合并為一個(gè)文件:cat file1 file2 > file

3.命令參數(shù):

-A, --show-all 等價(jià)于 -vET

-b, --number-nonblank 對(duì)非空輸出行編號(hào)

-e 等價(jià)于 -vE

-E, --show-ends 在每行結(jié)束處顯示 $

-n, --number 對(duì)輸出的所有行編號(hào),由1開始對(duì)所有輸出的行數(shù)編號(hào)

-s, --squeeze-blank 有連續(xù)兩行以上的空白行,就代換為一行的空白行

-t 與 -vT 等價(jià)

-T, --show-tabs 將跳格字符顯示為 ^I

-u (被忽略)

-v, --show-nonprinting 使用 ^ 和 M- 引用,除了 LFD 和 TAB 之外

4.使用實(shí)例:

實(shí)例一:把 log2012.log 的文件內(nèi)容加上行號(hào)后輸入 log2013.log 這個(gè)文件里

命令:

cat -n log2012.log log2013.log

輸出:

復(fù)制代碼

代碼如下:

[root@localhost test]# cat log2012.log

2012-01

2012-02

======[root@localhost test]# cat log2013.log

2013-01

2013-02

2013-03

[root@lzgonline init.d]# cat /var/log/messages | grep mount。

$connect=new mysqli("localhost","root","root","test")。

[root@localhost ~]$[root@localhost ~]$ cat /etc/group | grep mysql。

[root@localhost samba]# mkdir /opt/test#創(chuàng)建共享目錄test。

1 2012-01

2 2012-02

3

4

5 ======

6 2013-01

7 2013-02

8

9

10 2013-03

11 ======[root@localhost test]#

說明:

實(shí)例二:把 log2012.log 和 log2013.log 的文件內(nèi)容加上行號(hào)(空白行不加)之后將內(nèi)容附加到 log.log 里。

命令:

cat -b log2012.log log2013.log log.log

輸出:

復(fù)制代碼

代碼如下:

[root@localhost test]# cat -b log2012.log log2013.log log.log

1 2012-01

2 2012-02

3 ======

4 2013-01

5 2013-02

6 2013-03

7 ======[root@localhost test]#

實(shí)例三:把 log2012.log 的文件內(nèi)容加上行號(hào)后輸入 log.log 這個(gè)文件里

命令:

輸出:

復(fù)制代碼

代碼如下:

[root@localhost test]# cat log.log

[root@localhost test]# cat -n log2012.log > log.log

[root@localhost test]# cat -n log.log

1 2012-01

2 2012-02

3

4

5 ======

[root@localhost test]#

實(shí)例四:使用here doc來生成文件

輸出:

復(fù)制代碼

代碼如下:

[root@localhost test]# cat >log.txt Hello

> World

> Linux