Do you know a similar program for wc (unix word count command) on Windows? [closed]

Solution 1:

Even easier, find /c. ex:

netstat -an | find /c "ESTABLISHED"

find /c: Displays only the count of lines containing the string.

Solution 2:

You can use the original "wc", built for windows: it is part of the coreutils package. Get the most recent coreutils exe.

Solution 3:

For unix tools on windows your options are:

msys - similair to unixtools, originally just a few build tools needed to go with mingw (native version of gcc), now has almost all of the cygwin tools

cygwin - just about everythign for unix, complex install and requires a dll to provide unix api. Can be problems mixing tools built with different versions of cygwin.dll

Unixtools - not all the tools provided by cygwin but compiled natively

ch - pretty much all the unix tools, compiled natively. And a shell which includes a 'c' interpreter. The standard version is free (beer) but not open source.

uwin - free from ATT, includes the korn shell if you like that sort of thing.

mks a Commercial port of unix tools. Rather expensive given the free versions available.

Solution 4:

Try:

find /c /v "~any string that will never occur~"

This command gives a count of all lines that DO NOT contain the search string. Testing it, I see a problem that it doesn't seem to count blank lines at the end of a file.