linux/shell 文本文件删除/删掉空行(Notepad++ v5.8.7,TextFX, 删除空行)
分别用sed awk perl grep 实现:
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
工具:
Notepad++ v5.8.7,TextFX, 删除空行。
步骤如下:
1 Notepad++ 打开文件
2 选中要处理的文本
3 TextFX -- Edit -- Delete Surplus Blank Lines