码迷,mamicode.com
首页 > 系统相关 > 详细

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

时间:2016-02-29 16:46:19      阅读:167      评论:0      收藏:0      [点我收藏+]

标签: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

本文出自 “boyhack” 博客,请务必保留此出处http://461205160.blog.51cto.com/274918/1746031

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

标签:linux下查找文件中空行的行号

原文地址:http://461205160.blog.51cto.com/274918/1746031

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!