How do I remove blank lines in Unix?

Vy Bùi

New member
How do I remove blank lines in Unix?
Answer
Simple solution is by using grep (GNU or BSD) command as below.
  1. Remove blank lines (not including lines with spaces). grep . file.txt.
  2. Remove completely blank lines (including lines with spaces). grep “S” file.txt.
 

Tìm kiếm

Back
Top