nonblank

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

时光毁灭记忆、已成空白 提交于 2019-12-17 17:23:57
问题 In Bash, how do I count the number of non-blank lines of code in a project? 回答1: cat foo.c | sed '/^\s*$/d' | wc -l And if you consider comments blank lines: cat foo.pl | sed '/^\s*#/d;/^\s*$/d' | wc -l Although, that's language dependent. 回答2: #!/bin/bash find . -path './pma' -prune -o -path './blog' -prune -o -path './punbb' -prune -o -path './js/3rdparty' -prune -o -print | egrep '\.php|\.as|\.sql|\.css|\.js' | grep -v '\.svn' | xargs cat | sed '/^\s*$/d' | wc -l The above will give you

Count non blank rows in a certain range/column Excel

会有一股神秘感。 提交于 2019-12-10 16:06:10
问题 I want to count empty (or non-blank) rows in a given column (or range). Example: I have a column which is spaning over 4 cells width, and each cell has either a single ''x'' or is empty. There is up to 100 rows under this column. Here's a picture to clarify: 回答1: The COUNTA() function will do that for you. For example: =COUNTA(A1:A100) Will return the number of non-blank cells in the range A1:A100 回答2: Use a new column to get the number of blank cells in each row, then count the number of row

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

旧街凉风 提交于 2019-11-28 02:42:49
In Bash, how do I count the number of non-blank lines of code in a project? cat foo.c | sed '/^\s*$/d' | wc -l And if you consider comments blank lines: cat foo.pl | sed '/^\s*#/d;/^\s*$/d' | wc -l Although, that's language dependent. #!/bin/bash find . -path './pma' -prune -o -path './blog' -prune -o -path './punbb' -prune -o -path './js/3rdparty' -prune -o -print | egrep '\.php|\.as|\.sql|\.css|\.js' | grep -v '\.svn' | xargs cat | sed '/^\s*$/d' | wc -l The above will give you the total count of lines of code (blank lines removed) for a project (current folder and all subfolders recursively