SHELL删除空白行

xhn@xu-pc:~$ cat file2.txt
Line 1  Line 2

Line 2 
Line 3

Line 4
Line 5
Line 6
Line 7

Line 8
Line 9
Line 10

xhn@xu-pc:~$ sed '/^$/d' file2.txt
Line 1  Line 2
Line 2 
Line 3
Line 4
Line 5
Line 6
Line 7
Line 8
Line 9
Line 10
xhn@xu-pc:~$ gawk '/./ {print $0}' file2.txt  
Line 1  Line 2
Line 2 
Line 3
Line 4
Line 5
Line 6
Line 7
Line 8
Line 9
Line 10

你可能感兴趣的:(linux学习)