0

I've got a .txt file like this:

enter image description here

I want to get it like this:

enter image description here

I'm thinking I need to replace /(beginning of line)(new line character)/.

1 Answers1

4

Please don't post pictures of text; copy and paste from the terminal into the question.

There are several ways to filter out blank lines. Two of the simplest would be as follows.

With grep:

grep -v '^$' /path/to/input > /path/to/output

With sed:

sed '/^$/d' /path/to/input > /path/to/output
sed --in-place '/^$/d' /path/to/input # modify the file rather than creating a new one
DopeGhoti
  • 76,081