wcコマンドでファイルの行数、単語数、バイト数をカウントする方法
wcコマンドでファイルの行数、単語数、バイト数をカウントするにはオプションを指定せずに実行します。それぞれの結果を表示したい場合は-l、-w、-cオプションを指定します。
オプションの説明
-c, --bytes print the byte counts -l, --lines print the newline counts -w, --words print the word counts
オションを指定しない場合と、-l、-w、-cオプションを指定した場合
$ cat test.txt This is a pen. 1 あいうえお $ wc test.txt 3 6 33 test.txt $ wc -l test.txt 3 test.txt $ wc -w test.txt 6 test.txt $ wc -c test.txt 33 test.txt