第一种方法
[email protected]:~/test/28$ cat test -n
1 one
2
[email protected]:~/test/28$ grep '.*' test -n
1:one
2:
[email protected]:~/test/28$ grep ^$ test -n
2:
ev[email protected]:~/test/28$ grep ^$ test -n |awk -F : '{print $1}'
2
第二种方法
cat test -n |awk '$2~/^$/{print $1}'
ps 知识点补充
~ performs a case-sensitive match
Passwords are case-sensitive, so note which letters you capitalize.
密码要区分大小写,要注意大写的字母。