[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Source code lines counter

From: Bart Robinson <lomew_at_pobox.com>
Date: 2006-08-26 02:04:31 CEST

On 2006-8-11 Blair Zajac <blair@orcaware.com> wrote:
> Noah Slater wrote:
> > Vigo,
> >
> > You can run this on *nix based systems:
> >
> > $ find . -type f | xargs cat | wc -l
>
> You do want to prune the .svn directories and handle names with whitespace in it:
>
> find . -name .svn -prune -o -type f -print0 | xargs -0 cat | wc -l
>
> If you don't mind seeing the line counts for each file and run a little faster:
>
> find . -name .svn -prune -o -type f -print0 | xargs -0 wc -l

You have to be careful interpreting the results of that last one
when you have a large number of files because xargs may invoke
your command more than once due to the system argv size limit
(see sysconf(3)). Your output may look like:

  938 file1
  . . .
  123 fileN
21232 total (probably won't see this whiz by...)
  234 fileN+1
  . . .
 3434 fileN+M
34343 total (...and will think this is the actual total)

-- bart

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Sat Aug 26 02:05:53 2006

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.