1. grep -n '^$' nowcoder.txt |cut -d ':' -f 1 2. grep -n '^$' nowcoder.txt | awk -F: '{print $1}' 3. grep -n '^$' nowcoder.txt | sed 's/\:/\ /g' 4. awk 'NF==0{print NR}' nowcoder.txt。NF :当前记录(行)中的字段数(即分隔符分割后的列数) 5. awk '/^$/ {print NR}' ; NR :当前记录行号 ;