wc
語法
wc [options] files
不笑,很正經(jīng),只是個計數(shù)命令,計算行數(shù)好像用的最多。
參數(shù)
-c | --bytes顯示字節(jié)數(shù)。-m | --chars顯示字符數(shù)。-l | --lines顯示新行數(shù)。--files0-from=F從文件F中以NUL結(jié)尾的名稱指定的文件讀取輸入;如果F是-則從標(biāo)準(zhǔn)輸入讀取名稱-L | --max-line-length顯示最大顯示寬度-w | --words顯示單詞數(shù)。--help顯示幫助信息。--version顯示版本信息。
Example
-
wc file標(biāo)準(zhǔn)輸出,3個數(shù)字分別表示file文件的行數(shù)、單詞數(shù),以及該文件的字節(jié)數(shù)。
root@ecd79fccf553:/# wc file 6 19 110 file root@ecd79fccf553:/# cat file line1 with a space. line2 . line3. with a tab line4. with four space line5. with eight space line6. -
wc -l file僅行數(shù)。
root@ecd79fccf553:/# wc -l file 6 file -
wc -w file僅單詞數(shù)。
root@ecd79fccf553:/# wc -w file 19 file wc -c file
僅字符數(shù)。
```
root@ecd79fccf553:/# wc -c file
110 file
root@ecd79fccf553:/# wc -m file
110 file
```
-
wc -L file最寬的行。
root@ecd79fccf553:/# wc -L file 30 file