Gossamer Forum
Home : General : Chit Chat :

Line Counting

Quote Reply
Line Counting
Does anyone know of a good recursive line counting utility for windows?

I've just created a modulated perl script and it is *about* a quarter of a million lines in total but I'd like to find the exact amount.

I guess I could write a perl script to do it but I'm exausted already Wink
Quote Reply
Re: [Coombes] Line Counting In reply to
This should be pretty easy to do with File::Find. In your wanted sub just open the file and count the lines. Store the number in a scalar declared outside of the sub and you should be all set. If there are really that many modules, it might take a bit to run though :) It should only take you a couple of minutes to write.

~Charlie
Quote Reply
Re: [Coombes] Line Counting In reply to
Download cygwin and do:

wc `find . -type f`

and it will recursively scan all directories and give you a total number of lines, words and bytes.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Line Counting In reply to
Thanks - I gave that a go but it looks as though the -t in -type is causing a problem as "wc" reports that -t is an unknown switch. Do I need to use ' instead of `?

Thanks.

Last edited by:

Coombes: Dec 12, 2003, 10:59 AM
Quote Reply
Re: [Coombes] Line Counting In reply to
You want to use backticks (the character above the ~).

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Line Counting In reply to
That's what I tried which gave the error :(
Quote Reply
Re: [Alex] Line Counting In reply to
Ugh sorry my fault I was using the command prompt instead of the cygwin command line.

Sorry Blush
Quote Reply
Re: [Alex] Line Counting In reply to
Could he have used qx// instead? Just curious...
Quote Reply
Re: [Alex] Line Counting In reply to
I sort of over-egged the line count Crazy ...its was 40,000