Count number of blank lines in a file

前端 未结 7 907
抹茶落季
抹茶落季 2021-02-01 01:38

In count (non-blank) lines-of-code in bash they explain how to count the number of non-empty lines.

But is there a way to count the number of blank lines in a file? By

相关标签:
7条回答
  • 2021-02-01 02:40

    grep -cx '\s*' file

    or

    grep -cx '[[:space:]]*' file

    That is faster than the code in Steve's answer.

    0 讨论(0)
提交回复
热议问题