linux下查找文件中空行的行号

Posted ℡正儿八经

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux下查找文件中空行的行号相关的知识,希望对你有一定的参考价值。

linux下查找文件中空行的行号

linux下查找文件中空行的行号

以aa.txt举例:

方法1:sed -n \'/[a-zA-Z0-9@#$%^&*]/!=\' aa.txt
方法2:grep -n ^$ aa.txt
方法3:awk \'/^$/{print NR}\' aa.txt
方法4:sed -n \'/^$/=\' aa.txt

https://www.cnblogs.com/stono/p/11578093.html

以上是关于linux下查找文件中空行的行号的主要内容,如果未能解决你的问题,请参考以下文章