0
点赞
收藏
分享

微信扫一扫

Linux shell 脚本攻略学习笔记八

TiaNa_na 2022-01-28 阅读 50


Linux shell 脚本攻略学习笔记八之wc命令

1.wc 命令

wc - print newline, word, and byte counts for each file [打印每个文件的换行,单词,字节数。]

-l, --lines
print the newline counts
-w, --words
print the word counts

2.示例如下

[root@server4 shells]# echo -e "hello spark \nwo men dou shi hao hai zi \n"
hello spark
wo men dou shi hao hai zi

[root@server4 shells]# echo -e "hello spark \nwo men dou shi hao hai zi \n" | wc -w
9
[root@server4 shells]# man wc
[root@server4 shells]# echo -e "hello spark \nwo men dou shi hao hai zi \n" | wc -l
3



举报

相关推荐

0 条评论