![Linux Shell Scripting Cookbook(Third Edition)](https://wfqqreader-1252317822.image.myqcloud.com/cover/161/36701161/b_36701161.jpg)
上QQ阅读APP看书,第一时间看更新
Getting rid of extra blank lines
Some text files contain two or more blank lines together. If you need to remove the extra blank lines, use the following syntax:
$ cat -s file
Consider the following example:
$ cat multi_blanks.txt line 1 line 2 line 3 line 4 $ cat -s multi_blanks.txt # Squeeze adjacent blank lines line 1 line 2 line 3 line 4
We can remove all blank lines with tr, as discussed in the Translating with tr recipe in this chapter.