Saturday, March 28, 2020

How to count the number of lines of code?

How to count the number of lines of code?

You can do it simply by combining a few Linux tools. Suppose you are in a root directory that contains many recursive subdirectories and have Haskell (.hs) source files.

$ find . -name "*.hs" -exec wc \{\} \; | cut -c 1-8 | awk 'BEGIN {sum=0} {sum=sum+$0} END {print sum}'

END.


No comments: