WC
[root@localhost conf]# wc --help
使用法: wc [オプション]... [ファイル]...
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
-L, --max-line-length 最も長い行の長さを表示
-w, --words 単語数を表示
--help この使い方を表示して終了
--version バージョン情報を表示して終了
[root@localhost conf]#
接続を調べたりするのに利用できる。
[root@localhost conf]# netstat -n | grep "/var/run/dbus/system_bus_socket" | wc -l
4
[root@localhost conf]# netstat -n | grep "/var/run/dbus/system_bus_socket"
unix 3 [ ] STREAM CONNECTED 7397 /var/run/dbus/system_bus_socket
unix 3 [ ] STREAM CONNECTED 6216 /var/run/dbus/system_bus_socket
unix 3 [ ] STREAM CONNECTED 6179 /var/run/dbus/system_bus_socket
unix 3 [ ] STREAM CONNECTED 5349 /var/run/dbus/system_bus_socket
[root@localhost conf]# netstat -n | grep 80 | wc -l
4
[root@localhost conf]# netstat -n | grep 22 | wc -l
1
以下のように,ファイルないに特定の文字列がいくつあるかCountする事も出来る。
カテゴリ
Linuxトラックバック(0)
このブログ記事を参照しているブログ一覧: WC
このブログ記事に対するトラックバックURL: http://variable.jp/mt/mt-tb.cgi/29

コメントする