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