wc は、ファイルの行数や単語数など、ファイルに関する詳細を取得できるLinuxユーティリティです。
コマンドの最も便利なオプションは次のとおりです。
-w, --words prints the number of worlds
-l, --lines prints the number of lines
-m, --chars prints the number of characters
ファイル内のワールドの数をカウントするには:
# wc -w textfile.txt
root@www [/]# wc -w textfile.txt
8531 textfile.txt
root@www [/]#
ファイルの行数をカウントするには:
# wc -l textfile.txt
root@web [/]# wc -l textfile.txt
198 textfile.txt
root@web [/]#
ファイル内の文字数をカウントするには:
# wc -m textfile.txt
root@web [/]# wc -m textfile.txt
57678 textfile.txt
root@web [/]#
このコマンドの詳細については、 #man wcを実行してください。
参照:
wcmanファイル