Mac OS X, Mac OS X Server, Ubuntu Remove Empty Lines From A File July 12, 2015 The following command will remove all empty lines from a file called badcommand.sh: sed '/^$/d' badcommand.sh