count (non-blank) lines-of-code in bash

前端 未结 19 1435
耶瑟儿~
耶瑟儿~ 2020-12-07 07:14

In Bash, how do I count the number of non-blank lines of code in a project?

19条回答
  •  攒了一身酷
    2020-12-07 08:11

    grep -v '^\W*$' `find -type f` | grep -c '.' > /path/to/lineCountFile.txt
    

    gives an aggregate count for all files in the current directory and its subdirectories.

    HTH!

提交回复
热议问题