views:

7122

answers:

10

A quick search gives me tawbaware wc, but it does not accept stdout as input stream, meaning I can not use pipe within a DOS session.

Note: I can not install cygwin or use powershell (which would have allowed a '|foreach-object {(get-content $_).count}')

unxutils and and gnuwin32 Packages might have this feature...

+11  A: 

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

florin
downloading it now, but a quick (too quick) survey of the page http://gnuwin32.sourceforge.net/packages.html did not let me believe wc was included in that distribution...
VonC
installed and used with a |. It works (provided libiconv2.dll and libintl3.dll are there as well). Thank you!
VonC
+2  A: 

Well, I'm sorry to disagree, but unxutils do have a wc.exe

Give it a try!

Cheers,

Vinzz
you are right, my initial search was too quick. +1 but I will go with coreutils
VonC
+2  A: 

My unxutils pack has word count:

C:\Java\vssWorkspace\java\portlets_core>wc -l C:\Users\malp\AppData\Local\Temp__portlets41366.html 79717 C:\Users\malp\AppData\Local\Temp__portlets41366.html

Besides, the unxutils page indicates wc.exe is available. Are you looking for something that wc.exe does not handle?

Miguel Ping
you are right, my initial search was too quick. +1 but I will go with coreutils
VonC
A: 

I know nothing about it, but a quick google search for "windows wc" returned this: http://www.mkssoftware.com/docs/man1/wc.1.asp. Itappears to be freeware, but I'm not positive.

warren
I made the same request: it seems to be not free, and ask for an "evaluation request"
VonC
A: 

It also seems to be part of the cygwin install

Andrew Cox
A: 

There is also WinXs 4.2, it's shareware, so you could see if it'll do what you need it to.

Could you install a script language for this? It might be overkill, but if it gets the job done with a minimum of fuss...

interesting, but not free. As for the scripting language, the startup time is too slow compared to a single wc.exe (we have 5-6 years old PC... ;-) )
VonC
+4  A: 

For unix tools on windows your options are:

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

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

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.

Martin Beckett
Thank you for that list. I will certainly refer to it for any future similar request. +1
VonC
A: 

getgnuwin32 facilitates downloading and installing of gnuwin32 (which certainly has wc utility).

J.F. Sebastian
A: 

Simply do it in C. A few lines of code...

True, but that suppose you have en environment ready to easily edit and then compile your C code... a quick download it much easier ;)
VonC
I tried to do something like that based on the old [Software Tools in Pascal](http://cm.bell-labs.com/cm/cs/who/bwk/pascaltools.txt "pascal tools tape") book in Turbo Pascal but it was buggey at first. I'm not even sure why.
waynecolvin
A: 

Here's a good option, too -- roll your own in Perl:

http://en.literateprograms.org/Word_count_%28Perl%29

Luckily someone gave you the source. This is what I'm trying now, to avoid installing more packages. A simple machine is a healthy machine.

Chris Blanc