1 sed '/^$/d' input.txt > output.txt #output file: output.txt 2 sed -i '/^$/d' input.txt #output file: input.txt 3 awk 'NF > 0' input.txt > output.txt #output file: output.txt 4 perl -i.backup -n -e "print if /\S/" input.txt #output file: input.txt.backup 5 grep -v '^$' input.txt > output.txt #output file: output.txt
删除文件中的空行
最新推荐文章于 2023-12-10 13:42:14 发布