On Fri, 2 Dec 2005, The Ghost wrote: > I want to know how many new line chars there are in all files in a > directory (and it's subdirectories). What's the best way?
I'm sure this isn't how you want to do it, but this might work: $ cat `find . -type f` | wc -l It'll choke if you have too many files in the directory in question, as there are limits to how long the argument list can be in the shell, but provided that you don't exceed that limit, this will get you a quick and dirty answer to your question. Otherwise, you'll need to build up a list with File::Find or similar module, then work through the list looking for newline chatacters for each file in that list. It should get the same result as above, but will take more hand-coding to get to the final result, and it shouldn't hit the limitation of too many files that the shell approach will have. -- Chris Devers *
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>