Wc (UNIX)

Article on other languages:

del.icio.us del.icio.us
Digg Digg
Furl Furl
Reddit Reddit
Rojo Rojo
Add to OnlyWire


wcWord Count の略)はUNIXオペレーティングシステムのコマンドの一種。

標準入力か指定されたファイルのリストを読み込み、各種統計情報を生成する。出力情報としては、バイト数、単語数、行数(改行文字の個数)などがある。複数のファイル名を指定した場合、各ファイルの情報と合計が表示される。

wc の実行例を以下に示す。

$ wc ideas.txt excerpt.txt 
     40     149     947 ideas.txt
   2294   16638   97724 excerpt.txt
   2334   16787   98671 total

最初のカラムは行数、2番目のカラムは単語数、最後のカラムは文字数である。

最近の wc はバイト文字を区別できる。これはUnicodeの多バイト文字を含む場合に差が生じる。どちらを表示させるかはオプションで -c-m を使うことで指定できる。

GNU wcはかつてGNU textutilsパッケージに含まれていたが、現在ではGNU coreutilsに含まれている。

使用法

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

外部リンク

This article is from Wikipedia. All text is available under the terms of the GNU Free Documentation License.


Giant Panda

Mercedes Car
James Bond Guide
This site monitored by SitePinger.net