精品丰满熟女一区二区三区_五月天亚洲欧美综合网_亚洲青青青在线观看_国产一区二区精选

  • <menu id="29e66"></menu>

    <bdo id="29e66"><mark id="29e66"><legend id="29e66"></legend></mark></bdo>

  • <pre id="29e66"><tt id="29e66"><rt id="29e66"></rt></tt></pre>

      <label id="29e66"></label><address id="29e66"><mark id="29e66"><strike id="29e66"></strike></mark></address>
      學(xué)習(xí)啦 > 學(xué)習(xí)電腦 > 操作系統(tǒng) > Linux教程 > Linux系統(tǒng)中wc命令使用詳解

      Linux系統(tǒng)中wc命令使用詳解

      時(shí)間: 佳洲1085 分享

      Linux系統(tǒng)中wc命令使用詳解

        Linux系統(tǒng)中wc命令是統(tǒng)計(jì)文件文本的字節(jié)數(shù)等并顯示輸出。下面由學(xué)習(xí)啦小編為大家整理了linux系統(tǒng)中wc命令使用詳解,希望對(duì)大家有幫助!

        Linux系統(tǒng)中wc命令使用詳解

        Linux系統(tǒng)中的wc(Word Count)命令的功能為統(tǒng)計(jì)指定文件中的字節(jié)數(shù)、字?jǐn)?shù)、行數(shù),并將統(tǒng)計(jì)結(jié)果顯示輸出。

        1.命令格式:

        wc [選項(xiàng)]文件...

        2.命令功能:

        統(tǒng)計(jì)指定文件中的字節(jié)數(shù)、字?jǐn)?shù)、行數(shù),并將統(tǒng)計(jì)結(jié)果顯示輸出。該命令統(tǒng)計(jì)指定文件中的字節(jié)數(shù)、字?jǐn)?shù)、行數(shù)。如果沒(méi)有給出文件名,則從標(biāo)準(zhǔn)輸入讀取。wc同時(shí)也給出所指定文件的總統(tǒng)計(jì)數(shù)。

        3.命令參數(shù):

        -c 統(tǒng)計(jì)字節(jié)數(shù)。

        -l 統(tǒng)計(jì)行數(shù)。

        -m 統(tǒng)計(jì)字符數(shù)。這個(gè)標(biāo)志不能與 -c 標(biāo)志一起使用。

        -w 統(tǒng)計(jì)字?jǐn)?shù)。一個(gè)字被定義為由空白、跳格或換行字符分隔的字符串。

        -L 打印最長(zhǎng)行的長(zhǎng)度。

        -help 顯示幫助信息

        --version 顯示版本信息

        Linux系統(tǒng)中wc命令詳解實(shí)例

        在默認(rèn)的情況下,wc將計(jì)算指定文件的行數(shù)、字?jǐn)?shù),以及字節(jié)數(shù)。使用的命令為:

        wc testfile

        先查看testfile文件的內(nèi)容,可以看到:

        $ cat testfile

        Linux networks are becoming more and more common, but scurity is often an overlooked

        issue. Unfortunately, in today’s environment all networks are potential hacker targets,

        fro0m tp-secret military research networks to small home LANs.

        Linux Network Securty focuses on securing Linux in a networked environment, where the

        security of the entire network needs to be considered rather than just isolated machines.

        It uses a mix of theory and practicl techniques to teach administrators how to install and

        use security applications, as well as how the applcations work and why they are necesary.

        使用 wc統(tǒng)計(jì),結(jié)果如下:

        $ wc testfile # testfile文件的統(tǒng)計(jì)信息

        3 92 598 testfile # testfile文件的行數(shù)為3、單詞數(shù)92、字節(jié)數(shù)598

        其中,3 個(gè)數(shù)字分別表示testfile文件的行數(shù)、單詞數(shù),以及該文件的字節(jié)數(shù)。

        如果想同時(shí)統(tǒng)計(jì)多個(gè)文件的信息,例如同時(shí)統(tǒng)計(jì)testfile、testfile_1、testfile_2,可使用如下命令:

        wc testfile testfile_1 testfile_2 #統(tǒng)計(jì)三個(gè)文件的信息

        輸出結(jié)果如下:

        $ wc testfile testfile_1 testfile_2 #統(tǒng)計(jì)三個(gè)文件的信息

        3 92 598 testfile #第一個(gè)文件行數(shù)為3、單詞數(shù)92、字節(jié)數(shù)598

        9 18 78 testfile_1 #第二個(gè)文件的行數(shù)為9、單詞數(shù)18、字節(jié)數(shù)78

        3 6 32 testfile_2 #第三個(gè)文件的行數(shù)為3、單詞數(shù)6、字節(jié)數(shù)32

        15 116 708 總用量 #三個(gè)文件總共的行數(shù)為15、單詞數(shù)116、字節(jié)數(shù)708

        linux系統(tǒng)中wc命令常見(jiàn)用法

        默認(rèn)使用wc統(tǒng)計(jì)/etc/passwd

        #wc /etc/passwd

        40 45 1719 /etc/passwd

        40是行數(shù),45是單詞數(shù),1719是字節(jié)數(shù)

        wc的命令比較簡(jiǎn)單使用,每個(gè)參數(shù)使用如下:

        #wc -l /etc/passwd #統(tǒng)計(jì)行數(shù),在對(duì)記錄數(shù)時(shí),很常用

        40 /etc/passwd #表示系統(tǒng)有40個(gè)賬戶

        #wc -w /etc/passwd #統(tǒng)計(jì)單詞出現(xiàn)次數(shù)

        45 /etc/passwd

        #wc -m /etc/passwd #統(tǒng)計(jì)文件的字節(jié)數(shù)

        1719

      3645586