How do I do a “word count” command in Windows Command Prompt

夙愿已清 提交于 2019-12-08 17:20:43

问题


I know the command in Unix/Linux systems is "wc" but that doesn't work in Windows.


回答1:


The closest I know of is the PowerShell equivalent Measure-Object.




回答2:


find command could be used in windows cmd to find line count (with the /c switch), word count etc.

http://rickardnobel.se/counting-lines-in-windows-command-prompt/




回答3:


"Find" will be able to do the task similar to word count as RRM told.

Eg.

Query user | find /v /c ""

/v – Show any lines that don’t contain the string of words you specified. /c - Count the number of lines that matches the word in fine.

Query user | find /i "active" /c

/i - Ignore case /c - Count the number of lines that matches the word in fine.




回答4:


wc is part of the GNU Core Utils for Windows. I often install GnuWin32 utilities on Microsoft Windows systems to supply equivalents to the commands I use regularly on Linux and OS X systems.



来源:https://stackoverflow.com/questions/29177443/how-do-i-do-a-word-count-command-in-windows-command-prompt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!