查找文件中的空白行数 [英] find the number of blank lines in a file
问题描述
我需要在所有以``.h''扩展名结尾的文件中的特定目录中找到空白行的数量.
在此先感谢
OP的其他信息是从下面的评论中复制的
首先使用命令ls /usr/include/ | grep ''.h$''
显示所有.h文件.
现在,我不知道如何继续打开所有这些.h文件以及如何查找空白行.
我已尝试grep -n ^$ filename | wc -l
来查找特定文件的空白行数.
但是我需要知道如何使两个命令一起工作.请帮忙.
Hi,
I need to find the number of blank lines from a particular directory in all the files that ends with ''.h'' extension.
Thanks in advance
OP''s additional information copied from comment below
First displayed all the .h files using the command ls /usr/include/ | grep ''.h$''
.
Now, I dont know how to proceed to open all those .h files and how to find blank lines.
I have tried grep -n ^$ filename | wc -l
, to find the number of blank lines for a particular file.
But I need to know how to make both commands to work together. Please help.
推荐答案
''.
现在,我不知道如何继续打开所有这些.h文件以及如何查找空白行.
我已尝试grep -n ^
''.
Now, I dont know how to proceed to open all those .h files and how to find blank lines.
I have triedgrep -n ^
filename | wc -l来查找特定文件的空白行数.
但是我需要知道如何使两个命令一起工作.请帮忙.
filename | wc -l, to find the number of blank lines for a particular file.
But I need to know how to make both commands to work together. Please help.
这篇关于查找文件中的空白行数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!