How linux removes blank lines from a file
This article mainly shows you the "linux how to remove the blank lines in the document", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "linux how to remove the blank lines in the document" this article.
Four methods to remove blank lines from a file
The test file is as follows:
$cat tmp.txt abcdesed$ sed'/ ^ $/ d' tmp.txtgrep$ grep. Tmp.txtor$ grep-Ev "^ $" tmp.txtor$ grep-v-e'^ $'tmp.txtawk$ awk NF tmp.txtor$ awk'! / ^ $/ 'tmp.txtor$ awk' /. / 'tmp.txttr$ cat tmp.txt | tr-s'\ n 'are all the contents of the article "how to remove blank lines in a file by linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!