The blagotube home of Sune Kirkeby. Here are rambling rants and some bits of code.

01. Dec
2003

Kata Thirteen

Paraphrasing Kata Thirteen:

Your mission, should you choose to accept it, is to count lines of actual code in Java source-code.

Let us see, the real task is to remove comments from the source code, anything left after that must be actual code-lines. So, this should suffice (assuming GNU cpp(1)):

cpp -fpreprocessed -P - - \
| grep -v '^[[:space:]]*$' \
| wc -l

No need to complicate the task with a real programming language, when we have all the tools available.

This post was written by Sune Kirkeby on 2003-12-01, and claimed to be mostly about rambling.

Code Fu