wc 统计文件的行数
生活随笔
收集整理的這篇文章主要介紹了
wc 统计文件的行数
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
1.命令功能
wc 統(tǒng)計(jì)文件的行數(shù),單詞和字節(jié)數(shù)
2.語法格式
wc? option? file
wc? option? --files0-from=F
參數(shù)說明
| 參數(shù) | 參數(shù)說明 |
| -c | 統(tǒng)計(jì)字節(jié)數(shù) |
| -m | 統(tǒng)計(jì)字符數(shù) |
| -l | 統(tǒng)計(jì)行數(shù) |
| -w | 統(tǒng)計(jì)單詞數(shù) |
| -L | 打印最長行的長度 |
3.使用范例
范例1 查看passwd文件字節(jié)數(shù)、字?jǐn)?shù)、行數(shù)。
[root@localhost ~]# wc /etc/passwd #不接參數(shù)25 33 1076 /etc/passwd #25表示行數(shù);33表示單詞數(shù);1076表示字節(jié)數(shù)[root@localhost ~]# wc -c /etc/passwd #統(tǒng)計(jì)字節(jié)數(shù)1076 /etc/passwd[root@localhost ~]# wc -m /etc/passwd #統(tǒng)計(jì)字符數(shù)1076 /etc/passwd[root@localhost ~]# wc -w /etc/passwd #統(tǒng)計(jì)單詞數(shù)33 /etc/passwd[root@localhost ~]# wc -l /etc/passwd #統(tǒng)計(jì)行數(shù)25 /etc/passwd[root@localhost ~]# wc -L /etc/passwd #統(tǒng)計(jì)最長行的長度66 /etc/passwd范例2 查看登錄系統(tǒng)的用戶數(shù)
[root@localhost ~]# whoroot pts/0 2018-04-24 14:23 (172.16.2.100)root pts/1 2018-04-24 15:15 (172.16.2.100)root pts/2 2018-04-24 14:32 (172.16.2.100)root pts/3 2018-04-24 15:19 (172.16.2.100)[root@localhost ~]# who |wc -l4轉(zhuǎn)載于:https://www.cnblogs.com/joechu/p/8947610.html
總結(jié)
以上是生活随笔為你收集整理的wc 统计文件的行数的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 设置其他用户文件、文件夹权限与现用户权限
- 下一篇: shell获取命令返回结果前多少行(n行