[root@mail ~]# cat aa.txt
hahahaha
aaaaaaa
aaaaaaa
bbbbbbbbbbbbb
vvvvvvvv
ddddddddd
vvvvvvvv
aaaaaaa
bbbbbbbbbbbbb
ddddddddddd
$
#
345
345
a5^
[root@mail ~]# sed -n '/[a-zA-Z0-9@#$%^&*]/!=' aa.txt
4
[root@mail ~]# grep -n ^$ aa.txt (感谢soulmate)
4:
[root@mail ~]# awk '/^$/{print NR}' aa.txt (感谢继续飞翔)
4
[root@mail ~]# sed -n '/^$/=' aa.txt (感谢继续飞翔)
4
本文出自 “blog.itsir.org” 博客,请务必保留此出处http://297020555.blog.51cto.com/1396304/579640