sed删除空行和开头的空格和tab键
[root@ob1 scripts]# cat -An tt2.txt
1 jeyry$
2 ^I$
3 jfdkjfdjk$
4 ^Ikjfdkjfdkj$
5 klfdklfdkl$
6 fdjkkjf dfj ^Ifkdjkjf$
7 ^I$
8 ffdkkjfd$
[root@ob1 scripts]# sed -rn '/^[ \t]*$/!s#^[ \t]*##gp' tt2.txt
jeyry
jfdkjfdjk
kjfdkjfdkj
klfdklfdkl
fdjkkjf dfj fkdjkjf
ffdkkjfd
==============================================
[root@ob1 scripts]# cat -An tt2.txt
1 jeyry$
2 ^I$
3 jfdkjfdjk$
4 ^Ikjfdkjfdkj$
5 klfdklfdkl$
6 fdjkkjf dfj ^Ifkdjkjf$
7 ^I$
8 ffdkkjfd$
9 $
10 $
11 dfyufudjhdf$
12 $
13 jkfjkdf$
14 $
[root@ob1 scripts]# sed -rn '/^[ \t]*$/!s#^[ \t]*##gp' tt2.txt
jeyry
jfdkjfdjk
kjfdkjfdkj
klfdklfdkl
fdjkkjf dfj fkdjkjf
ffdkkjfd
dfyufudjhdf
jkfjkdf
时来天地皆同力,运去英雄不自由