What is the command to delete empty lines in a file using sed?

command, linux, sed, unix

Solution

You have to 'd' which is used to delete.

Ex:

 sed -i '/^$/d' test

-i - is used to affect the file.

^ - is a beginning of line

$ - is a end of line

d - delete if there is a empty line

I hope this will help you.

Problem

- What is the `sed` command to delete empty lines in a file. - What is the command (`sed` command?) to delete empty files in a folder?

Original source