bash wc是做什么的?以及如何使用它来计算文件中的字数?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/37668111/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 22:19:42  来源:igfitidea点击:

What does wc do? And how do you use it to count words in a file?

bash

提问by Ramiel526

I'm new to the Linux/Unix world but found this decent online resource https://linuxjourney.comthat's sort of explains some general command line code. I'm running an Oracle VM with Ubuntu based variant. I'm away from my computer now so I don't know which version but I'm fairly certain it's bash4

我是 Linux/Unix 世界的新手,但发现这个不错的在线资源https://linuxjourney.com可以解释一些通用的命令行代码。我正在使用基于 Ubuntu 的变体运行 Oracle VM。我现在不在电脑旁,所以我不知道是哪个版本,但我很确定它是 bash4

回答by Kebabman

WC (Word Count) is a simple command line utility that displays the number of words in a file. It is especially useful for text files. Word documents, Libre office documents etc are a different matter.

WC(字数统计)是一个简单的命令行实用程序,可显示文件中的字数。它对文本文件特别有用。Word 文档、Libre 办公文档等是另一回事。

Simply type 'wc ' and it will output the number of words in the file. If you need more information, type 'man wc' in a terminal and it will show you the full list of options.

只需键入“wc”,它就会输出文件中的单词数。如果您需要更多信息,请在终端中输入“man wc”,它会显示完整的选项列表。