how can I count lines of code?

2013-03-27 Thread larry google groups
I am curious, is there a simple command line script I could use to count 
lines of code? Or is there some trick in emacs that I can do? I'd like to 
know how many lines there are, minus the comments and white space. 

-- 
-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: how can I count lines of code?

2013-03-27 Thread Nick Ward
Not sure if this is the correct place to be asking this, but

sed '/^\s*$/d;/^\s*;/d' path/to/your/file | wc -l

On Wed, Mar 27, 2013 at 7:36 PM, larry google groups
lawrencecloj...@gmail.com wrote:
 I am curious, is there a simple command line script I could use to count
 lines of code? Or is there some trick in emacs that I can do? I'd like to
 know how many lines there are, minus the comments and white space.

 --
 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with your
 first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.



-- 
-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: how can I count lines of code?

2013-03-27 Thread Haim Ashkenazi
Hi

I know of two tools. Both of them however count docstrings as code:


   - cloc - http://cloc.sourceforge.net
   - lein-vanity - A leiningen plugin (
   https://github.com/dgtized/lein-vanity).

HTH

On Wed, Mar 27, 2013 at 9:36 PM, larry google groups 
lawrencecloj...@gmail.com wrote:

 I am curious, is there a simple command line script I could use to count
 lines of code? Or is there some trick in emacs that I can do? I'd like to
 know how many lines there are, minus the comments and white space.

 --
 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.






-- 
Haim

-- 
-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: how can I count lines of code?

2013-03-27 Thread Michael Gardner
On Mar 27, 2013, at 14:36 , larry google groups lawrencecloj...@gmail.com 
wrote:

 I am curious, is there a simple command line script I could use to count 
 lines of code? Or is there some trick in emacs that I can do? I'd like to 
 know how many lines there are, minus the comments and white space. 

On Linux or Mac, try `wc' (the first number printed is the one you want). To 
omit whitespace and comments, you could pipe the file through grep -v first:

$ grep -vxE '[[:space:]]*(;.*)?' file.clj | wc
117 4493567

That regular expression matches any line that consists of zero or more 
whitespace characters, followed by an optional suffix that starts with a 
semicolon. Not perfect, but should be good enough for most purposes.

(Cue the old now you have two problems joke about regexes…)

-- 
-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: how can I count lines of code?

2013-03-27 Thread larry google groups

Thank you, all. 


On Wednesday, March 27, 2013 4:01:31 PM UTC-4, Michael Gardner wrote:

 On Mar 27, 2013, at 14:36 , larry google groups 
 lawrenc...@gmail.comjavascript: 
 wrote: 

  I am curious, is there a simple command line script I could use to count 
 lines of code? Or is there some trick in emacs that I can do? I'd like to 
 know how many lines there are, minus the comments and white space. 

 On Linux or Mac, try `wc' (the first number printed is the one you want). 
 To omit whitespace and comments, you could pipe the file through grep -v 
 first: 

 $ grep -vxE '[[:space:]]*(;.*)?' file.clj | wc 
 117 4493567 

 That regular expression matches any line that consists of zero or more 
 whitespace characters, followed by an optional suffix that starts with a 
 semicolon. Not perfect, but should be good enough for most purposes. 

 (Cue the old now you have two problems joke about regexes…) 



-- 
-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.