I've got a .txt file like this:
I want to get it like this:
I'm thinking I need to replace /(beginning of line)(new line character)/
.
I've got a .txt file like this:
I want to get it like this:
I'm thinking I need to replace /(beginning of line)(new line character)/
.
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
grep -v '^$'
? – Stephen Harris Aug 17 '16 at 01:32