FILE:
hello
world
foo
bar
How can when remove all the empty new lines in this FILE?
Output of command:
FILE:
hello
world
foo
bar
FILE:
hello
world
foo
bar
How can when remove all the empty new lines in this FILE?
Output of command:
FILE:
hello
world
foo
bar
grep . FILE(And if you really want to do it in sed, then: sed -e /^$/d FILE)
(And if you really want to do it in awk, then: awk /./{print} FILE)
with awk, just check for number of fields. no need regex
$ more file
hello
world
foo
bar
$ awk 'NF' file
hello
world
foo
bar