krypted.com

Tiny Deathstars of Foulness

The following command will remove all empty lines from a file called badcommand.sh: sed '/^$/d' badcommand.sh

July 12th, 2015

Posted In: Mac OS X, Mac OS X Server, Ubuntu

Tags: , , , ,

  • Tony Williams

    Only for some definitions of “empty”. You could improve it. `sed ‘/^[t|s]*$/d’ badcommand.sh’ ` This also removes lines with just spaces and/or tabs/

  • Tony Williams

    Only for some definitions of “empty”. You could improve it.

    sed ‘/^[t|s]*$/d’ badcommand.sh

    This also removes lines with just spaces and/or tabs/.