分别用sed awk perl grep 实现:
1 sed '/^$/d' input.txt > output.txt #output file: output.txt2 sed -i '/^$/d' input.txt #output file: input.txt3 awk 'NF > 0' input.txt > output.txt #output file: output.txt4 perl -i.backup -n -e "print if /\S/" input.txt #output file: input.txt.backup5 grep -v '^$' input.txt > output.txt #output file: output.txt