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

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