Asked • 04/28/19

Delete empty lines using sed?

I am trying to delete empty lines using sed: sed '/^$/d' but I have no luck with it. For example, I have these lines: xxxxxx yyyyyy zzzzzz and I want it to be like: xxxxxx yyyyyy zzzzzz What should be the code for this?

Diamond D.

This command works fine on my end. What's the sed version that you're using (sed --version)? How are you running sed? Are you trying to delete it from a file?
Report

10/16/22

1 Expert Answer

By:

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.