Thursday, March 11, 2010

Shell Script :: Remove empty lines

To empty lines from a file
$ sed '/^$/d' filename > filename.out; mv filename.out filename

- removes all blank lines in the file
- writes to another file called filename.out
- rename the filename.out as filename

No comments:

Post a Comment