Linux shell 脚本攻略学习笔记八

TiaNa_na

关注

阅读 50

2022-01-28


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)

0 0 举报