5种方法去掉空行

# 显示未被正则表达式匹配的行
sed -n '/^$/!p' nowcoder.txt

# 显示不为空的行
awk -n '{if ($0 != "") print $0}' nowcoder.txt

awk '!/^$/ {print $NF}'

# 排除文件中符合表达式的行,并显示其他行
grep -v '^$' nowcoder.txt

awk NF nowcoder.txt