Saturday, March 18, 2006

Counting lines of code

I wanted to count the lines of code for a project I was working on and realized that it can be done with some simple regexp and commands. Thought I'd share:

find dir -type f | egrep "(\.xml|\.java|\.jsp|\.tag|\.sql|\.html|\.tld|\.css)$" | xargs cat | egrep -v "^[\s\t]*$" | wc -l


I was surprised that there are companies that sell software to do the above. God I hate over engineering

3 comments:

  1. Sami, be careful, that last line is borderline subversive talk in your current surroundings. FYI, I was at the HOJ on Thursday (first time in months). Maybe I'll see you there next time.

    ReplyDelete
  2. HOJ?A new name for WTF?

    ReplyDelete
  3. I am on the hairy edge :)... Hope to see at HOJ soon

    ReplyDelete