Posted By

bubnoff on 05/11/11


Tagged

sed


Versions (?)

Delete blank lines with sed


 / Published in: Bash
 

Find any line with beginning of line followed by zero or more tabs, spaces followed by end of line -- delete it.

  1. sed '/^[\t ]*$/d' file

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: bubnoff on May 21, 2011

Used in conjuction with http://snipplr.com/view/53323/merge-lines-with-sed/ and tr to prettify clunky Sybase output for collection codes. Basically just saves a tree.

sed -e '$!N;s/\n/ /' -e '/^[\t ]*$/d' collection_codes.txt | tr -s ' ' >collection_codes_pretty_print.txt

You need to login to post a comment.