Get the App
SLTechnology News&Howtos  ›  Development  › 

How linux removes blank lines from a file

Shulou Source: shulou.com Published: 2022-06-01 13:03:13 10月01日 Update

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!

Tags: Documents blank lines content articles learning help methods easy to understand more organization knowledge editing industry information information channels channels testing research Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Shulou Information Redmi Apple Huawei