FILE
:
hello world foo bar
How can I remove all the empty new lines in this FILE
?
Output of command:
FILE
:
hello world foo bar
By Using [: blank:] Keyword To create a file on the terminal, including the following commands. Text written in these files contains spaces between them, as seen in the figure below. These blank lines can be removed using a blank command to ignore empty spaces between the words or strings.
We can remove blank lines using awk: $ awk NF < myfile.
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 /./ FILE
)
Try the following:
grep -v -e '^$'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With