wcの最近のブログ記事

リナックス linux コマンド wc 使い方 使用方法 例

指定されたファイルを読み込み、

出力情報として、バイト数、単語数、行数(改行文字の個数)などがある。

複数のファイル名を指定した場合、各ファイルの情報と合計が表示される。

   wc -l <ファイル名> 行数を表示
   wc -c <ファイル名> バイト数を表示
   wc -m <ファイル名> 文字数を表示
   wc -L <ファイル名> 最長行を表示
   wc -w <ファイル名> 単語数を表示

ubuntu にて$ man wc 実行結果------------------------------------------------------------------------------------------

DESCRIPTION
       Print newline, word, and byte counts for each FILE, and a total line if more than
       one FILE is specified.  With no FILE, or when FILE is -, read standard input.

       -c, --bytes
              print the byte counts

       -m, --chars
              print the character counts

       -l, --lines
              print the newline counts

       --files0-from=F
              read input from the files specified by NUL-terminated names in file F

       -L, --max-line-length
              print the length of the longest line

       -w, --words
              print the word counts

       --help display this help and exit

       --version
              output version information and exit


ubuntu にて$ man wc 実行結果------------------------------------------------------------------------------------------

以下、wc実行例

$ cat 22222
1234567890

$ wc -c 22222
11 22222


$ wc -m 22222
11 22222

$ wc -l 22222
1 22222

$ wc -L 22222
10 22222

$ wc -w 22222
1 22222

$ wc --help
Usage: wc [OPTION]... [FILE]...
  or:  wc [OPTION]... --files0-from=F
Print newline, word, and byte counts for each FILE, and a total line if
more than one FILE is specified.  With no FILE, or when FILE is -,
read standard input.
  -c, --bytes            print the byte counts
  -m, --chars            print the character counts
  -l, --lines            print the newline counts
      --files0-from=F    read input from the files specified by
                           NUL-terminated names in file F
  -L, --max-line-length  print the length of the longest line
  -w, --words            print the word counts
      --help     この使い方を表示して終了
      --version  バージョン情報を表示して終了

バグを発見したら <bug-coreutils@gnu.org> 宛に報告して下さい.


$ wc --version
wc (GNU coreutils) 6.10
Copyright c 2008 Free Software Foundation, Inc.
Licence GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Paul Rubin and David MacKenzie.



サーバ構築(ランキング)