tag:blogger.com,1999:blog-14307486.post7029689404611636126..comments2024-03-28T11:24:13.222+00:00Comments on theatre of noise: Line Of Code Counterrobinhttp://www.blogger.com/profile/08743788064455642852noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-14307486.post-28295555908291058872010-09-24T15:37:39.777+01:002010-09-24T15:37:39.777+01:00Thanks Zach -- right you are! And one could also u...Thanks Zach -- right you are! And one could also use a grep function in Python, but I am allergic to regular expressions. I think my time with Perl burnt out those particular brain cells.robinhttps://www.blogger.com/profile/08743788064455642852noreply@blogger.comtag:blogger.com,1999:blog-14307486.post-31115938706931801152010-09-24T15:09:50.026+01:002010-09-24T15:09:50.026+01:00This is also available on a Unix system as the fol...This is also available on a Unix system as the following, without any nonstandard tools:<br /><br />find -iname *py | xargs egrep -v "((^\W+#)|(^$))" | wc -l<br /><br />In order, this:<br />- Finds all PY files<br />- Uses grep to remove all lines that:<br /> - The first nonspace character is #<br /> - Are empty lines<br />- Counts the number of remaining lines<br /><br />All of the above tools are very useful in many situations (find, xargs, and grep).Zachhttps://www.blogger.com/profile/03008329063902532712noreply@blogger.com