I tried to use 'sed' command to remove the empty lines. 

```
sed -i '/^$/d' file.txt

```

My sample txt file looks likes this. The second line has space characters. sed command only removes the empty lines but not the lines with white space. 

```
Sample text

Sample text

```

So is there away to accomplish this via bash.

My intended out put is

```
Sample text
Sample text

```