您的位置:首页 > 运维架构 > Shell

shell命令-wc

2016-05-30 14:20 621 查看

用途

统计文件中的字符数、单词数、行数

语法

wc [OPTION]… [FILE]…

wc [OPTION]… –files0-from=F

描述

-c 统计字节数

-m 统计字符数

-l 统计行数

-w 统计单词数

-L 统计最长行的字符数

–files0-from=F

read input from the files specified by NUL-terminated names in file F; If F is - then read names from standard input

举例

apuser@bjzktmp05u:~/Mygithub/shellscripts$ cat head.txt
asdfghjklzxcvbnm
123456789
987654321
7418522963
qwertgfdazxcv
a5sd4a65sd165w4d
hjasasdsaasd
akjsndaksjcnaksjc
apuser@bjzktmp05u:~/Mygithub/shellscripts$ wc -l head.txt
8 head.txt
apuser@bjzktmp05u:~/Mygithub/shellscripts$ wc -c head.txt
110 head.txt
apuser@bjzktmp05u:~/Mygithub/shellscripts$ wc -m head.txt
110 head.txt
apuser@bjzktmp05u:~/Mygithub/shellscripts$ wc -w head.txt
8 head.txt
apuser@bjzktmp05u:~/Mygithub/shellscripts$ wc -L head.txt
17 head.txt
统计的是这一行 akjsndaksjcnaksjc 共17个字符
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: