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)/.

Forwarding
  • 21
  • 1
  • 5

1 Answers1

3

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
  • 73,792
  • 8
  • 97
  • 133