linux命令之wc

1010阅读 0评论2018-03-17 Tay_linux
分类:LINUX

命令:

wc

用于计算文件的字节数、字数(不太清楚字数的是如何统计的)、行数。

用法:

Wc [option] [file]

 

Option

-l 统计文件的行数

-c 统计文件的字符数

-w 统计文件的字数

 

例子:

tay@tay:/mnt/hgfs/hzs/shell$ cat a.sh

123456789

123456789

tay@tay:/mnt/hgfs/hzs/shell$ wc -l a.sh

2 a.sh

tay@tay:/mnt/hgfs/hzs/shell$ wc -c a.sh

20 a.sh

tay@tay:/mnt/hgfs/hzs/shell$ wc -w a.sh

2 a.sh

tay@tay:/mnt/hgfs/hzs/shell$

 

 

上一篇:shell中select的用法
下一篇:shell脚本中读取文件的方法