Remove empty lines from a file

By | November 26, 2008

You can use awk to strip a file of empty line. Do it with

awk ‘NF>0’ < text_file

One thought on “Remove empty lines from a file

  1. pymonks

    Another longer alternative to create a new file minus the empty lines

    $ grep -v ^$ filename > filename.new

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *