[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 '/^[ ]*$/!s#^[ ]*##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 '/^[ ]*$/!s#^[ ]*##gp' tt2.txt
jeyry
jfdkjfdjk
kjfdkjfdkj
klfdklfdkl
fdjkkjf dfj fkdjkjf
ffdkkjfd
dfyufudjhdf
jkfjkdf