欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

SHELL删除空白行

程序员文章站 2022-03-03 23:07:19
...
[email protected]:~$ 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

[email protected]:~$ 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
[email protected]:~$ 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
相关标签: shell